diff --git a/cabal.project b/cabal.project index ed81710..9cf26d2 100644 --- a/cabal.project +++ b/cabal.project @@ -7,32 +7,32 @@ packages: source-repository-package type: git - location: https://github.com/oberblastmeister/tree-sitter-simple.git - tag: 309ac26ecbb94e6f534bff5c4c5c6a50808397e0 + location: https://github.com/josephsumabat/tree-sitter-simple.git + tag: 64f8a19b7e65a4a572770a92085f872caf212833 subdir: tree-sitter-simple source-repository-package type: git - location: https://github.com/oberblastmeister/tree-sitter-simple.git - tag: 309ac26ecbb94e6f534bff5c4c5c6a50808397e0 + location: https://github.com/josephsumabat/tree-sitter-simple.git + tag: 64f8a19b7e65a4a572770a92085f872caf212833 subdir: tree-sitter-haskell source-repository-package type: git - location: https://github.com/oberblastmeister/tree-sitter-simple.git - tag: 309ac26ecbb94e6f534bff5c4c5c6a50808397e0 + location: https://github.com/josephsumabat/tree-sitter-simple.git + tag: 64f8a19b7e65a4a572770a92085f872caf212833 subdir: tree-sitter-ast source-repository-package type: git - location: https://github.com/oberblastmeister/tree-sitter-simple.git - tag: 309ac26ecbb94e6f534bff5c4c5c6a50808397e0 + location: https://github.com/josephsumabat/tree-sitter-simple.git + tag: 64f8a19b7e65a4a572770a92085f872caf212833 subdir: haskell-ast source-repository-package type: git - location: https://github.com/oberblastmeister/tree-sitter-simple.git - tag: 309ac26ecbb94e6f534bff5c4c5c6a50808397e0 + location: https://github.com/josephsumabat/tree-sitter-simple.git + tag: 64f8a19b7e65a4a572770a92085f872caf212833 subdir: text-range source-repository-package @@ -40,4 +40,4 @@ source-repository-package location: https://github.com/oberblastmeister/tasty-expect.git tag: ec14d702660c79a907e9c45812958cd0df0f036f -test-show-details: direct \ No newline at end of file +test-show-details: direct diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 7dfdc1e..562add4 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,9 +1,9 @@ # Keep this up to date with cabal.project let tree-sitter-simple-repo = { - url = "https://github.com/oberblastmeister/tree-sitter-simple"; - sha256 = "sha256-8i2NYbILmGDH+0EIQ/UzRoyuonWzyAqFD06vbjEJH2g="; - rev = "309ac26ecbb94e6f534bff5c4c5c6a50808397e0"; + url = "https://github.com/josephsumabat/tree-sitter-simple"; + sha256 = "sha256-Taje8q2fYZzA68sSt8f9/oCDdYjTWegfoYusQtmrz8A="; + rev = "64f8a19b7e65a4a572770a92085f872caf212833"; fetchSubmodules = true; }; @@ -49,7 +49,8 @@ in hiedb = self.haskell.lib.dontCheck (haskellSuper.callHackage "hiedb" "0.6.0.1" {}); text-rope = haskellSuper.callHackage "text-rope" "0.2" {}; - lsp = haskellSuper.callHackage "lsp" "2.4.0.0" {}; + lsp-types = haskellSuper.callHackage "lsp-types" "2.3.0.0" {}; + lsp = haskellSuper.callHackage "lsp" "2.7.0.0" {}; }; }; } diff --git a/package.yaml b/package.yaml index 5243d88..d2d8927 100644 --- a/package.yaml +++ b/package.yaml @@ -21,24 +21,24 @@ tested-with: dependencies: - array >= 0.5.4 && < 0.6 - - base >= 4.17.0 && < 4.19 - - containers >= 0.6.0 && < 0.7 + - base >= 4.17.0 && < 4.21 + - containers >= 0.6.0 && < 0.8 - unordered-containers >= 0.2 && < 0.3 - errors >= 2.3.0 && < 2.4 - extra >= 1.7.12 && < 1.8 - directory >= 1.3.7 && < 1.4 - filepath - - ghc >= 9.4.3 && < 9.7 + - ghc >= 9.4.3 && < 9.11 - ghc-paths >= 0.1.0 && < 0.2 - haskell-lexer >=1.1.1 && <1.2.0 - hiedb >= 0.6 && < 0.7 - - lsp == 2.4.0.0 - - lsp-types == 2.1.0.0 + - lsp == 2.7.0.0 + - lsp-types == 2.3.0.0 - mtl >= 2.2.2 && < 2.4 - parsec >= 3.1.0 && < 3.2 - sqlite-simple >= 0.4.18 && < 0.5 - - template-haskell >= 2.19.0 && < 2.21 - - text >= 2.0.1 && < 2.1 + - template-haskell >= 2.19.0 && < 2.23 + - text >= 2.0.1 && < 2.2 - bytestring >=0.10 && <0.13 - transformers >= 0.5.6.2 && < 0.7 - unliftio-core >= 0.2.1 && < 0.3 diff --git a/src/StaticLS/Server.hs b/src/StaticLS/Server.hs index 6474f68..fc78a21 100644 --- a/src/StaticLS/Server.hs +++ b/src/StaticLS/Server.hs @@ -18,7 +18,6 @@ import Data.Text qualified as T import Language.LSP.Logging qualified as LSP.Logging import Language.LSP.Protocol.Message ( Method (..), - ResponseError (..), TMessage, ) import Language.LSP.Protocol.Message qualified as LSP @@ -114,7 +113,7 @@ initServer :: LoggerM IO -> LanguageContextEnv LspConfig -> TMessage 'Method_Initialize -> - IO (Either ResponseError (LanguageContextEnv LspConfig)) + IO (Either (LSP.TResponseError Method_Initialize) (LanguageContextEnv LspConfig)) initServer reactorChan staticEnvOptions logger serverConfig _ = do runExceptT $ do wsRoot <- ExceptT $ LSP.runLspT serverConfig getWsRoot @@ -127,11 +126,11 @@ initServer reactorChan staticEnvOptions logger serverConfig _ = do Conc.writeChan reactorChan $ ReactorMsgLspAct Handlers.handleGhcidFileChange pure serverConfig where - getWsRoot :: LSP.LspM config (Either ResponseError FilePath) + getWsRoot :: LSP.LspM config (Either (LSP.TResponseError Method_Initialize) FilePath) getWsRoot = do mRootPath <- LSP.getRootPath pure $ case mRootPath of - Nothing -> Left $ ResponseError (InR ErrorCodes_InvalidRequest) "No root workspace was found" Nothing + Nothing -> Left $ LSP.TResponseError (InR ErrorCodes_InvalidRequest) "No root workspace was found" Nothing Just p -> Right p serverDef :: StaticEnvOptions -> LoggerM IO -> IO (ServerDefinition ()) @@ -205,7 +204,7 @@ serverDef argOptions logger = do Exception.catchAny m $ \e -> logException e - respondWithError res e = res $ Left $ ResponseError (InR ErrorCodes_InvalidRequest) ("An error was caught: " <> T.pack (show e)) Nothing + respondWithError res e = res $ Left $ LSP.TResponseError (InR ErrorCodes_InvalidRequest) ("An error was caught: " <> T.pack (show e)) Nothing logException e = do LSP.Logging.logToLogMessage Colog.<& Colog.WithSeverity (T.pack (show e)) Colog.Error diff --git a/static-ls.cabal b/static-ls.cabal index 4266201..742da1c 100644 --- a/static-ls.cabal +++ b/static-ls.cabal @@ -1,6 +1,6 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack @@ -33,6 +33,70 @@ flag dev default: False library + hs-source-dirs: + src + default-extensions: + LambdaCase + ExplicitNamespaces + OverloadedRecordDot + OverloadedStrings + NoFieldSelectors + DuplicateRecordFields + DataKinds + PatternSynonyms + BlockArguments + ViewPatterns + ghc-options: -Wall -Wno-name-shadowing -Wincomplete-record-updates -fwrite-ide-info -hiedir test/TestData/.hiefiles -haddock + build-depends: + Diff + , aeson >=2 && <2.3 + , array >=0.5.4 && <0.6 + , async + , base >=4.17.0 && <4.21 + , bytestring >=0.10 && <0.13 + , co-log-core ==0.3.* + , containers >=0.6.0 && <0.8 + , cryptohash-md5 + , directory >=1.3.7 && <1.4 + , errors >=2.3.0 && <2.4 + , exceptions + , extra >=1.7.12 && <1.8 + , filepath + , fsnotify + , ghc >=9.4.3 && <9.11 + , ghc-paths >=0.1.0 && <0.2 + , hashable + , haskell-ast + , haskell-lexer >=1.1.1 && <1.2.0 + , hiedb ==0.6.* + , lens + , lsp ==2.7.0.0 + , lsp-types ==2.3.0.0 + , mtl >=2.2.2 && <2.4 + , neat-interpolation + , optics + , parsec >=3.1.0 && <3.2 + , pretty-simple + , raw-strings-qq + , regex-tdfa + , row-types + , sqlite-simple >=0.4.18 && <0.5 + , stm + , template-haskell >=2.19.0 && <2.23 + , text >=2.0.1 && <2.2 + , text-range + , text-rope ==0.2 + , transformers >=0.5.6.2 && <0.7 + , tree-sitter-ast + , tree-sitter-haskell + , tree-sitter-simple + , typed-process + , unliftio >=0.2.1 && <0.3 + , unliftio-core >=0.2.1 && <0.3 + , unordered-containers ==0.2.* + default-language: GHC2021 + if flag(dev) + ghc-options: -fwrite-ide-info -hiedir .hiefiles -hidir .hifiles -fdefer-type-errors -fno-defer-typed-holes -Werror=deferred-type-errors -Werror=deferred-out-of-scope-variables exposed-modules: Data.Change Data.ConcurrentCache @@ -107,8 +171,15 @@ library Paths_static_ls autogen-modules: Paths_static_ls + +executable print-hie hs-source-dirs: - src + print + main-is: Main.hs + other-modules: + Paths_static_ls + autogen-modules: + Paths_static_ls default-extensions: LambdaCase ExplicitNamespaces @@ -120,16 +191,16 @@ library PatternSynonyms BlockArguments ViewPatterns - ghc-options: -Wall -Wno-name-shadowing -Wincomplete-record-updates -fwrite-ide-info -hiedir test/TestData/.hiefiles -haddock + ghc-options: -Wall -Wno-name-shadowing -Wincomplete-record-updates -threaded -rtsopts -with-rtsopts=-N build-depends: Diff , aeson >=2 && <2.3 , array >=0.5.4 && <0.6 , async - , base >=4.17.0 && <4.19 + , base >=4.17.0 && <4.21 , bytestring >=0.10 && <0.13 , co-log-core ==0.3.* - , containers >=0.6.0 && <0.7 + , containers >=0.6.0 && <0.8 , cryptohash-md5 , directory >=1.3.7 && <1.4 , errors >=2.3.0 && <2.4 @@ -137,27 +208,29 @@ library , extra >=1.7.12 && <1.8 , filepath , fsnotify - , ghc >=9.4.3 && <9.7 + , ghc >=9.4.3 && <9.11 , ghc-paths >=0.1.0 && <0.2 , hashable , haskell-ast , haskell-lexer >=1.1.1 && <1.2.0 , hiedb ==0.6.* , lens - , lsp ==2.4.0.0 - , lsp-types ==2.1.0.0 + , lsp ==2.7.0.0 + , lsp-types ==2.3.0.0 , mtl >=2.2.2 && <2.4 , neat-interpolation , optics + , optparse-applicative >=0.17.0.0 && <0.19 , parsec >=3.1.0 && <3.2 , pretty-simple , raw-strings-qq , regex-tdfa , row-types , sqlite-simple >=0.4.18 && <0.5 + , static-ls , stm - , template-haskell >=2.19.0 && <2.21 - , text >=2.0.1 && <2.1 + , template-haskell >=2.19.0 && <2.23 + , text >=2.0.1 && <2.2 , text-range , text-rope ==0.2 , transformers >=0.5.6.2 && <0.7 @@ -172,14 +245,9 @@ library if flag(dev) ghc-options: -fwrite-ide-info -hiedir .hiefiles -hidir .hifiles -fdefer-type-errors -fno-defer-typed-holes -Werror=deferred-type-errors -Werror=deferred-out-of-scope-variables -executable print-hie - main-is: Main.hs - other-modules: - Paths_static_ls - autogen-modules: - Paths_static_ls +executable static-ls hs-source-dirs: - print + app default-extensions: LambdaCase ExplicitNamespaces @@ -197,10 +265,10 @@ executable print-hie , aeson >=2 && <2.3 , array >=0.5.4 && <0.6 , async - , base >=4.17.0 && <4.19 + , base >=4.17.0 && <4.21 , bytestring >=0.10 && <0.13 , co-log-core ==0.3.* - , containers >=0.6.0 && <0.7 + , containers >=0.6.0 && <0.8 , cryptohash-md5 , directory >=1.3.7 && <1.4 , errors >=2.3.0 && <2.4 @@ -208,15 +276,15 @@ executable print-hie , extra >=1.7.12 && <1.8 , filepath , fsnotify - , ghc >=9.4.3 && <9.7 + , ghc >=9.4.3 && <9.11 , ghc-paths >=0.1.0 && <0.2 , hashable , haskell-ast , haskell-lexer >=1.1.1 && <1.2.0 , hiedb ==0.6.* , lens - , lsp ==2.4.0.0 - , lsp-types ==2.1.0.0 + , lsp ==2.7.0.0 + , lsp-types ==2.3.0.0 , mtl >=2.2.2 && <2.4 , neat-interpolation , optics @@ -229,8 +297,8 @@ executable print-hie , sqlite-simple >=0.4.18 && <0.5 , static-ls , stm - , template-haskell >=2.19.0 && <2.21 - , text >=2.0.1 && <2.1 + , template-haskell >=2.19.0 && <2.23 + , text >=2.0.1 && <2.2 , text-range , text-rope ==0.2 , transformers >=0.5.6.2 && <0.7 @@ -244,16 +312,23 @@ executable print-hie default-language: GHC2021 if flag(dev) ghc-options: -fwrite-ide-info -hiedir .hiefiles -hidir .hifiles -fdefer-type-errors -fno-defer-typed-holes -Werror=deferred-type-errors -Werror=deferred-out-of-scope-variables - -executable static-ls main-is: Main.hs other-modules: App.Arguments Paths_static_ls autogen-modules: Paths_static_ls + +test-suite expect_tests + type: exitcode-stdio-1.0 + main-is: Main.hs + other-modules: + HirTest + Paths_static_ls + autogen-modules: + Paths_static_ls hs-source-dirs: - app + expect_tests default-extensions: LambdaCase ExplicitNamespaces @@ -268,13 +343,14 @@ executable static-ls ghc-options: -Wall -Wno-name-shadowing -Wincomplete-record-updates -threaded -rtsopts -with-rtsopts=-N build-depends: Diff + , QuickCheck , aeson >=2 && <2.3 , array >=0.5.4 && <0.6 , async - , base >=4.17.0 && <4.19 + , base >=4.17.0 && <4.21 , bytestring >=0.10 && <0.13 , co-log-core ==0.3.* - , containers >=0.6.0 && <0.7 + , containers >=0.6.0 && <0.8 , cryptohash-md5 , directory >=1.3.7 && <1.4 , errors >=2.3.0 && <2.4 @@ -282,29 +358,32 @@ executable static-ls , extra >=1.7.12 && <1.8 , filepath , fsnotify - , ghc >=9.4.3 && <9.7 + , ghc >=9.4.3 && <9.11 , ghc-paths >=0.1.0 && <0.2 , hashable , haskell-ast , haskell-lexer >=1.1.1 && <1.2.0 , hiedb ==0.6.* + , hspec ==2.* , lens - , lsp ==2.4.0.0 - , lsp-types ==2.1.0.0 + , lsp ==2.7.0.0 + , lsp-types ==2.3.0.0 , mtl >=2.2.2 && <2.4 , neat-interpolation , optics - , optparse-applicative >=0.17.0.0 && <0.19 , parsec >=3.1.0 && <3.2 , pretty-simple + , quickcheck-instances , raw-strings-qq , regex-tdfa , row-types , sqlite-simple >=0.4.18 && <0.5 , static-ls , stm - , template-haskell >=2.19.0 && <2.21 - , text >=2.0.1 && <2.1 + , tasty + , tasty-expect + , template-haskell >=2.19.0 && <2.23 + , text >=2.0.1 && <2.2 , text-range , text-rope ==0.2 , transformers >=0.5.6.2 && <0.7 @@ -319,16 +398,10 @@ executable static-ls if flag(dev) ghc-options: -fwrite-ide-info -hiedir .hiefiles -hidir .hifiles -fdefer-type-errors -fno-defer-typed-holes -Werror=deferred-type-errors -Werror=deferred-out-of-scope-variables -test-suite expect_tests +test-suite static-ls-test type: exitcode-stdio-1.0 - main-is: Main.hs - other-modules: - HirTest - Paths_static_ls - autogen-modules: - Paths_static_ls hs-source-dirs: - expect_tests + test default-extensions: LambdaCase ExplicitNamespaces @@ -340,17 +413,17 @@ test-suite expect_tests PatternSynonyms BlockArguments ViewPatterns - ghc-options: -Wall -Wno-name-shadowing -Wincomplete-record-updates -threaded -rtsopts -with-rtsopts=-N + ghc-options: -Wall -Wno-name-shadowing -Wincomplete-record-updates -fwrite-ide-info -fwrite-interface -hiedir test/TestData/.hiefiles -hidir test/TestData/.hifiles -haddock -threaded -rtsopts -with-rtsopts=-N build-depends: Diff , QuickCheck , aeson >=2 && <2.3 , array >=0.5.4 && <0.6 , async - , base >=4.17.0 && <4.19 + , base >=4.17.0 && <4.21 , bytestring >=0.10 && <0.13 , co-log-core ==0.3.* - , containers >=0.6.0 && <0.7 + , containers >=0.6.0 && <0.8 , cryptohash-md5 , directory >=1.3.7 && <1.4 , errors >=2.3.0 && <2.4 @@ -358,7 +431,7 @@ test-suite expect_tests , extra >=1.7.12 && <1.8 , filepath , fsnotify - , ghc >=9.4.3 && <9.7 + , ghc >=9.4.3 && <9.11 , ghc-paths >=0.1.0 && <0.2 , hashable , haskell-ast @@ -366,8 +439,8 @@ test-suite expect_tests , hiedb ==0.6.* , hspec ==2.* , lens - , lsp ==2.4.0.0 - , lsp-types ==2.1.0.0 + , lsp ==2.7.0.0 + , lsp-types ==2.3.0.0 , mtl >=2.2.2 && <2.4 , neat-interpolation , optics @@ -380,10 +453,8 @@ test-suite expect_tests , sqlite-simple >=0.4.18 && <0.5 , static-ls , stm - , tasty - , tasty-expect - , template-haskell >=2.19.0 && <2.21 - , text >=2.0.1 && <2.1 + , template-haskell >=2.19.0 && <2.23 + , text >=2.0.1 && <2.2 , text-range , text-rope ==0.2 , transformers >=0.5.6.2 && <0.7 @@ -397,9 +468,6 @@ test-suite expect_tests default-language: GHC2021 if flag(dev) ghc-options: -fwrite-ide-info -hiedir .hiefiles -hidir .hifiles -fdefer-type-errors -fno-defer-typed-holes -Werror=deferred-type-errors -Werror=deferred-out-of-scope-variables - -test-suite static-ls-test - type: exitcode-stdio-1.0 main-is: Main.hs other-modules: Data.ConcurrentCacheSpec @@ -434,72 +502,4 @@ test-suite static-ls-test Paths_static_ls autogen-modules: Paths_static_ls - hs-source-dirs: - test - default-extensions: - LambdaCase - ExplicitNamespaces - OverloadedRecordDot - OverloadedStrings - NoFieldSelectors - DuplicateRecordFields - DataKinds - PatternSynonyms - BlockArguments - ViewPatterns - ghc-options: -Wall -Wno-name-shadowing -Wincomplete-record-updates -fwrite-ide-info -fwrite-interface -hiedir test/TestData/.hiefiles -hidir test/TestData/.hifiles -haddock -threaded -rtsopts -with-rtsopts=-N - build-depends: - Diff - , QuickCheck - , aeson >=2 && <2.3 - , array >=0.5.4 && <0.6 - , async - , base >=4.17.0 && <4.19 - , bytestring >=0.10 && <0.13 - , co-log-core ==0.3.* - , containers >=0.6.0 && <0.7 - , cryptohash-md5 - , directory >=1.3.7 && <1.4 - , errors >=2.3.0 && <2.4 - , exceptions - , extra >=1.7.12 && <1.8 - , filepath - , fsnotify - , ghc >=9.4.3 && <9.7 - , ghc-paths >=0.1.0 && <0.2 - , hashable - , haskell-ast - , haskell-lexer >=1.1.1 && <1.2.0 - , hiedb ==0.6.* - , hspec ==2.* - , lens - , lsp ==2.4.0.0 - , lsp-types ==2.1.0.0 - , mtl >=2.2.2 && <2.4 - , neat-interpolation - , optics - , parsec >=3.1.0 && <3.2 - , pretty-simple - , quickcheck-instances - , raw-strings-qq - , regex-tdfa - , row-types - , sqlite-simple >=0.4.18 && <0.5 - , static-ls - , stm - , template-haskell >=2.19.0 && <2.21 - , text >=2.0.1 && <2.1 - , text-range - , text-rope ==0.2 - , transformers >=0.5.6.2 && <0.7 - , tree-sitter-ast - , tree-sitter-haskell - , tree-sitter-simple - , typed-process - , unliftio >=0.2.1 && <0.3 - , unliftio-core >=0.2.1 && <0.3 - , unordered-containers ==0.2.* - default-language: GHC2021 - if flag(dev) - ghc-options: -fwrite-ide-info -hiedir .hiefiles -hidir .hifiles -fdefer-type-errors -fno-defer-typed-holes -Werror=deferred-type-errors -Werror=deferred-out-of-scope-variables build-tool-depends: hspec-discover:hspec-discover == 2.*