Skip to content

Commit

Permalink
build on macOS + get on latest lsp-types
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom McLaughlin committed Dec 5, 2024
1 parent a8be909 commit 9708273
Show file tree
Hide file tree
Showing 22 changed files with 125 additions and 75 deletions.
10 changes: 9 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

PATH_add .aliases

export NIX_PATH=nixpkgs=$(nix run .#nixpkgsPath)
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi

export STACK_YAML=$(pwd)/stack/stack-9.6.6.yaml

if [ "$(uname)" = "Darwin" ]; then
export STACK_CONFIG="$(pwd)/config_darwin.yaml"
fi

use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
test_runs/
result
dist-newstyle

.direnv
4 changes: 2 additions & 2 deletions bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import Language.LSP.Protocol.Types
import Language.LSP.Transformer


addU = TextDocumentContentChangeEvent $ InL (#range .== (Range (p 0 7) (p 0 7)) .+ #rangeLength .== Nothing .+ #text .== "u")
addU = TextDocumentContentChangeEvent $ InL $ TextDocumentContentChangePartial (Range (p 0 7) (p 0 7)) Nothing "u"

Check warning on line 30 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.2

Top-level binding with no type signature:

Check warning on line 30 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.6

Top-level binding with no type signature:

Check warning on line 30 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.4

Top-level binding with no type signature:

Check warning on line 30 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.8

Top-level binding with no type signature:

p :: Int -> Int -> Position
p l c = Position (fromIntegral l) (fromIntegral c)


repackChangeEvent (DT.ChangeEvent range text) = TextDocumentContentChangeEvent $ InL $ #range .== repackRange range .+ #rangeLength .== Nothing .+ #text .== text
repackChangeEvent (DT.ChangeEvent range text) = TextDocumentContentChangeEvent $ InL $ TextDocumentContentChangePartial (repackRange range) Nothing text

Check warning on line 36 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.2

Top-level binding with no type signature:

Check warning on line 36 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.6

Top-level binding with no type signature:

Check warning on line 36 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.4

Top-level binding with no type signature:

Check warning on line 36 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.8

Top-level binding with no type signature:
repackRange (DT.Range (DT.Position l1 c1) (DT.Position l2 c2)) = Range (Position (fromIntegral l1) (fromIntegral c1)) (Position (fromIntegral l2) (fromIntegral c2))

Check warning on line 37 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.2

Top-level binding with no type signature:

Check warning on line 37 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.6

Top-level binding with no type signature:

Check warning on line 37 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.4

Top-level binding with no type signature:

Check warning on line 37 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.8

Top-level binding with no type signature:

deriving instance Generic PragmaType

Check warning on line 39 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.2

Orphan instance: instance Generic PragmaType

Check warning on line 39 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.6

Orphan instance: instance Generic PragmaType

Check warning on line 39 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.4

Orphan instance: instance Generic PragmaType

Check warning on line 39 in bench/Main.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 9.8

Orphan class instance: instance Generic PragmaType
Expand Down
12 changes: 6 additions & 6 deletions build_all_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

set -e

stack build --stack-yaml stack-8.10.7.yaml
stack build --stack-yaml stack-9.0.2.yaml
stack build --stack-yaml stack-9.2.8.yaml
stack build --stack-yaml stack-9.4.8.yaml
stack build --stack-yaml stack-9.6.6.yaml
stack build --stack-yaml stack-9.8.2.yaml
stack build --stack-yaml stack/stack-8.10.7.yaml
stack build --stack-yaml stack/stack-9.0.2.yaml
stack build --stack-yaml stack/stack-9.2.8.yaml
stack build --stack-yaml stack/stack-9.4.8.yaml
stack build --stack-yaml stack/stack-9.6.6.yaml
stack build --stack-yaml stack/stack-9.8.2.yaml
6 changes: 6 additions & 0 deletions config_darwin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# Needed on macOS
extra-include-dirs:
- /opt/homebrew/include
extra-lib-dirs:
- /opt/homebrew/lib
7 changes: 4 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
inputs.haskellNix.url = "github:input-output-hk/haskell.nix/angerman/fix-install_name_tool";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-24.05";

outputs = { self, flake-utils, gitignore, haskellNix, nixpkgs }@inputs:
Expand Down Expand Up @@ -77,8 +77,14 @@
);

in
rec {
packages = rec {
{
devShells = {
default = pkgs.mkShell {
NIX_PATH = "nixpkgs=${pkgs.path}";
};
};

packages = {
inherit (pkgs) cabal2nix;

all = pkgs.linkFarm "haskell-notebook-language-server-all" allVersions;
Expand Down
5 changes: 1 addition & 4 deletions haskell-notebook-language-server.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.36.0.
-- This file has been generated from package.yaml by hpack version 0.37.0.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -72,7 +72,6 @@ library
, pcre-light
, regex-base
, regex-pcre-builtin
, row-types
, safe
, string-interpolate
, text
Expand Down Expand Up @@ -123,7 +122,6 @@ executable haskell-notebook-language-server
, optparse-applicative
, process
, retry
, safe
, string-interpolate
, text
, unix
Expand Down Expand Up @@ -175,7 +173,6 @@ test-suite haskell-notebook-language-server-test
, ihaskell
, lsp-types >=2.0.0.1
, monad-logger
, row-types
, sandwich
, sandwich-quickcheck
, string-interpolate
Expand Down
3 changes: 0 additions & 3 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ library:
- network-uri
- regex-base
- regex-pcre-builtin
- row-types
- safe
- text-rope
- time
Expand Down Expand Up @@ -80,7 +79,6 @@ executables:
- optparse-applicative
- process
- retry
- safe
- unix
- unliftio-core

Expand All @@ -103,7 +101,6 @@ tests:
- haskell-notebook-language-server
- ihaskell
- QuickCheck
- row-types
- sandwich
- sandwich-quickcheck
- text-rope
Expand Down
11 changes: 5 additions & 6 deletions src/Language/LSP/Transformer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import Data.Diff.Myers
import qualified Data.Diff.Types as DT
import Data.Kind
import qualified Data.List as L
import Data.Row
import Data.Text
import qualified Data.Text as T
import Data.Text.Rope (Rope)
Expand Down Expand Up @@ -88,7 +87,7 @@ defaultHandleDiff params before change _transformer = do
return (change', transformer')

where
repackChangeEvent (DT.ChangeEvent range text) = TextDocumentContentChangeEvent $ InL $ #range .== repackRange range .+ #rangeLength .== Nothing .+ #text .== text
repackChangeEvent (DT.ChangeEvent range text) = TextDocumentContentChangeEvent $ InL $ TextDocumentContentChangePartial (repackRange range) Nothing text
repackRange (DT.Range (DT.Position l1 c1) (DT.Position l2 c2)) = Range (Position (fromIntegral l1) (fromIntegral c1)) (Position (fromIntegral l2) (fromIntegral c2))

-- * Applying changes
Expand All @@ -106,11 +105,11 @@ applyChanges :: [J.TextDocumentContentChangeEvent] -> Rope -> Rope
applyChanges changes rope = L.foldl' (flip applyChange) rope changes

applyChange :: J.TextDocumentContentChangeEvent -> Rope -> Rope
applyChange (J.TextDocumentContentChangeEvent (InL withRange)) str =
changeChars str (Rope.Position (fromIntegral sl) (fromIntegral sc)) (Rope.Position (fromIntegral fl) (fromIntegral fc)) (withRange .! #text)
applyChange (J.TextDocumentContentChangeEvent (InL (TextDocumentContentChangePartial {..}))) str =

Check failure on line 108 in src/Language/LSP/Transformer.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 8.10

Not in scope: data constructor ‘TextDocumentContentChangePartial’
changeChars str (Rope.Position (fromIntegral sl) (fromIntegral sc)) (Rope.Position (fromIntegral fl) (fromIntegral fc)) _text

Check failure on line 109 in src/Language/LSP/Transformer.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 8.10

Ambiguous occurrence ‘_text’
where
J.Range (J.Position sl sc) (J.Position fl fc) = withRange .! #range
applyChange (J.TextDocumentContentChangeEvent (InR textOnly)) _ = Rope.fromText (textOnly .! #text)
J.Range (J.Position sl sc) (J.Position fl fc) = _range

Check failure on line 111 in src/Language/LSP/Transformer.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 8.10

Ambiguous occurrence ‘_range’
applyChange (J.TextDocumentContentChangeEvent (InR (TextDocumentContentChangeWholeDocument {..}))) _ = Rope.fromText _text

Check failure on line 112 in src/Language/LSP/Transformer.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 8.10

Not in scope:

Check failure on line 112 in src/Language/LSP/Transformer.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 8.10

Ambiguous occurrence ‘_text’

changeChars :: Rope -> Rope.Position -> Rope.Position -> Text -> Rope
changeChars str start finish new = mconcat [before', Rope.fromText new, after]
Expand Down
5 changes: 2 additions & 3 deletions src/Transform/ServerRsp/Hover.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Control.Monad.Logger
import Control.Monad.Reader
import qualified Data.List as L
import qualified Data.Map as M
import Data.Row.Records
import Data.String.Interpolate
import Data.Text as T
import Data.Text.Rope (Rope)
Expand Down Expand Up @@ -64,8 +63,8 @@ fixupDocumentReferences docRegex transformer _curLines (InR markedStrings) = (In
(MarkedString . InL) <$> (fixupDocumentReferences' appConfigDynFlags docRegex transformer t)
transformMarkedString (MarkedString (InR thing)) = do
AppConfig {..} <- asks transformerConfig
t' <- fixupDocumentReferences' appConfigDynFlags docRegex transformer (thing .! #value)
return $ MarkedString $ InR (thing & update #value t')
t' <- fixupDocumentReferences' appConfigDynFlags docRegex transformer (thing ^. value)
return $ MarkedString $ InR (thing & set value t')

fixupDocumentReferences' :: forall n. MonadLogger n => DynFlags -> Regex -> HaskellNotebookTransformer -> Text -> n Text
fixupDocumentReferences' flags docRegex transformer t =
Expand Down
6 changes: 5 additions & 1 deletion stack/stack-9.0.2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ extra-deps:
- git: https://github.com/codedownio/myers-diff.git
commit: 3683ab4e052347bc47eb5546361f47bcd8c0fa58

- lsp-types-2.0.0.1
- lsp-types-2.3.0.0
- hashable-1.4.7.0
- lens-5.3.2
- mod-0.2.0.1
- row-types-1.0.1.2
- data-array-byte-0.1.0.1

- ipython-kernel-0.11.0.0

Expand Down
36 changes: 32 additions & 4 deletions stack/stack-9.0.2.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,47 @@ packages:
commit: 3683ab4e052347bc47eb5546361f47bcd8c0fa58
git: https://github.com/codedownio/myers-diff.git
- completed:
hackage: lsp-types-2.0.0.1@sha256:259442a8d499b3a959cb6b12de331e586c6b37e2c4e1f9d82a542976ea728f41,29290
hackage: lsp-types-2.3.0.0@sha256:ca17a686bda5dc7ff04105ca7081dce5a90bcd050c8800a13efd68b7f0901f1c,34215
pantry-tree:
sha256: f8617d8aaa142ecc8ce62e0b2d930669d4969b6b9143368d20b1680874b8077c
size: 45522
sha256: 0bf22e394dc804c8cee74d19a7f38021cfd48a15082b39a14753c037f2a64288
size: 51996
original:
hackage: lsp-types-2.0.0.1
hackage: lsp-types-2.3.0.0
- completed:
hackage: hashable-1.4.7.0@sha256:573f3ab242f75465a0d67ce9d84202650a1606575e6dbd6d31ffcf4767a9a379,6629
pantry-tree:
sha256: 9ec168505c52fa389b7447a1251b302e32537adeecac88c2aa72beed53beb3bd
size: 1578
original:
hackage: hashable-1.4.7.0
- completed:
hackage: lens-5.3.2@sha256:d78e49e957fb789217c7a5a53b2c6355f80ee50e8ec229021d5913f590fe1284,15231
pantry-tree:
sha256: be507f05122ca71faae535819a33e8d9b6fbc1ef71526372929b61f9e9112e68
size: 8350
original:
hackage: lens-5.3.2
- completed:
hackage: mod-0.2.0.1@sha256:eeb316fef3a8c12f4e83bbeeea748e74d75fca54d4498d574ace92e464adb05a,2409
pantry-tree:
sha256: d469d7e415c1593f052d3ca647e4085ab759be378d25ca7d2eea0aab0083ce38
size: 590
original:
hackage: mod-0.2.0.1
- completed:
hackage: row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071
pantry-tree:
sha256: 6a3617038d3970095100d14d026c396002a115700500cf3004ffb67ae5a75611
size: 1060
original:
hackage: row-types-1.0.1.2
- completed:
hackage: data-array-byte-0.1.0.1@sha256:a4a1975fde77e289b605c45a3ef78d731d8c1834e4cef311152d910a1e94d98c,1989
pantry-tree:
sha256: 02f71ea84081a6e8d576e90511f76e476a397b53439ce4f73356e2f8df443a24
size: 326
original:
hackage: data-array-byte-0.1.0.1
- completed:
hackage: ipython-kernel-0.11.0.0@sha256:4e1c174037c4088b0113663d17c443fb6612e0f7639d28152c1e237816972550,2676
pantry-tree:
Expand Down
3 changes: 2 additions & 1 deletion stack/stack-9.2.8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ extra-deps:
- git: https://github.com/codedownio/myers-diff.git
commit: 3683ab4e052347bc47eb5546361f47bcd8c0fa58

- lsp-types-2.0.0.1
- lsp-types-2.3.0.0
- row-types-1.0.1.2
- mod-0.2.0.1

- ipython-kernel-0.11.0.0

Expand Down
15 changes: 11 additions & 4 deletions stack/stack-9.2.8.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,26 @@ packages:
commit: 3683ab4e052347bc47eb5546361f47bcd8c0fa58
git: https://github.com/codedownio/myers-diff.git
- completed:
hackage: lsp-types-2.0.0.1@sha256:259442a8d499b3a959cb6b12de331e586c6b37e2c4e1f9d82a542976ea728f41,29290
hackage: lsp-types-2.3.0.0@sha256:ca17a686bda5dc7ff04105ca7081dce5a90bcd050c8800a13efd68b7f0901f1c,34215
pantry-tree:
sha256: f8617d8aaa142ecc8ce62e0b2d930669d4969b6b9143368d20b1680874b8077c
size: 45522
sha256: 0bf22e394dc804c8cee74d19a7f38021cfd48a15082b39a14753c037f2a64288
size: 51996
original:
hackage: lsp-types-2.0.0.1
hackage: lsp-types-2.3.0.0
- completed:
hackage: row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071
pantry-tree:
sha256: 6a3617038d3970095100d14d026c396002a115700500cf3004ffb67ae5a75611
size: 1060
original:
hackage: row-types-1.0.1.2
- completed:
hackage: mod-0.2.0.1@sha256:eeb316fef3a8c12f4e83bbeeea748e74d75fca54d4498d574ace92e464adb05a,2409
pantry-tree:
sha256: d469d7e415c1593f052d3ca647e4085ab759be378d25ca7d2eea0aab0083ce38
size: 590
original:
hackage: mod-0.2.0.1
- completed:
hackage: ipython-kernel-0.11.0.0@sha256:4e1c174037c4088b0113663d17c443fb6612e0f7639d28152c1e237816972550,2676
pantry-tree:
Expand Down
2 changes: 2 additions & 0 deletions stack/stack-9.4.8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ extra-deps:
- ./ghc-parser

- ipython-kernel-0.11.0.0

- lsp-types-2.3.0.0
7 changes: 7 additions & 0 deletions stack/stack-9.4.8.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ packages:
size: 792
original:
hackage: ipython-kernel-0.11.0.0
- completed:
hackage: lsp-types-2.3.0.0@sha256:ca17a686bda5dc7ff04105ca7081dce5a90bcd050c8800a13efd68b7f0901f1c,34215
pantry-tree:
sha256: 0bf22e394dc804c8cee74d19a7f38021cfd48a15082b39a14753c037f2a64288
size: 51996
original:
hackage: lsp-types-2.3.0.0
snapshots:
- completed:
sha256: a81fb3877c4f9031e1325eb3935122e608d80715dc16b586eb11ddbff8671ecd
Expand Down
11 changes: 2 additions & 9 deletions stack/stack-9.6.6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ resolver: lts-22.41
packages:
- ../

ghc-options:
"$everything": -with-rtsopts=-M12G

# Needed on macOS
extra-include-dirs:
- /opt/homebrew/include
extra-lib-dirs:
- /opt/homebrew/lib

nix:
# pure: false
packages:
Expand All @@ -30,3 +21,5 @@ extra-deps:
subdirs:
- .
- ./ghc-parser

- lsp-types-2.3.0.0
7 changes: 7 additions & 0 deletions stack/stack-9.6.6.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ packages:
commit: 7df14126586fd32f841fa1a99ce5ec5ec7a20fa4
git: https://github.com/codedownio/IHaskell.git
subdir: ./ghc-parser
- completed:
hackage: lsp-types-2.3.0.0@sha256:ca17a686bda5dc7ff04105ca7081dce5a90bcd050c8800a13efd68b7f0901f1c,34215
pantry-tree:
sha256: 0bf22e394dc804c8cee74d19a7f38021cfd48a15082b39a14753c037f2a64288
size: 51996
original:
hackage: lsp-types-2.3.0.0
snapshots:
- completed:
sha256: 1e32b51d9082fdf6f3bd92accc9dfffd4ddaf406404427fb10bf76d2bc03cbbb
Expand Down
4 changes: 1 addition & 3 deletions stack/stack-9.8.2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

resolver: nightly-2024-05-18
resolver: nightly-2024-10-21

packages:
- ../
Expand All @@ -21,5 +21,3 @@ extra-deps:
subdirs:
- .
- ./ghc-parser

- lsp-types-2.1.1.0
Loading

0 comments on commit 9708273

Please sign in to comment.