From 0fd58f52b0fafcfb240909b58d2513948322acb6 Mon Sep 17 00:00:00 2001 From: kokobd Date: Sat, 27 Aug 2022 18:03:50 +0800 Subject: [PATCH 01/12] upgrade lsp --- cabal.project | 19 +++++++++++++++---- ghcide/src/Development/IDE/Types/Location.hs | 6 +----- hls-plugin-api/src/Ide/PluginUtils.hs | 5 +---- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/cabal.project b/cabal.project index 047c2efcc2..77e3a91652 100644 --- a/cabal.project +++ b/cabal.project @@ -65,13 +65,24 @@ source-repository-package tag: 7a0af7a8fd38045fd15fb13445bdcc7085325460 -- https://github.com/tibbe/ekg-json/pull/12 --- Needed for ghcide-bench until a new release of lsp-test is out +-- Remove me when a new version of lsp is released source-repository-package type:git - location: https://github.com/haskell/lsp + location: https://github.com/kokobd/lsp + subdir: lsp + tag: 80ebd816454a9e44d4cd93793ef3badc661b0f2f + +source-repository-package + type:git + location: https://github.com/kokobd/lsp + subdir: lsp-types + tag: 80ebd816454a9e44d4cd93793ef3badc661b0f2f + +source-repository-package + type:git + location: https://github.com/kokobd/lsp subdir: lsp-test - tag: c95eb06c70c35f1e13c37ed11a7d9e5b36bfa2e8 - -- https://github.com/haskell/lsp/pull/450 + tag: 80ebd816454a9e44d4cd93793ef3badc661b0f2f allow-newer: -- ghc-9.2 diff --git a/ghcide/src/Development/IDE/Types/Location.hs b/ghcide/src/Development/IDE/Types/Location.hs index 24a61d8a27..9891606947 100644 --- a/ghcide/src/Development/IDE/Types/Location.hs +++ b/ghcide/src/Development/IDE/Types/Location.hs @@ -50,11 +50,7 @@ toNormalizedFilePath' "" = emptyFilePath toNormalizedFilePath' fp = LSP.toNormalizedFilePath fp emptyFilePath :: LSP.NormalizedFilePath -#if MIN_VERSION_lsp_types(1,3,0) -emptyFilePath = LSP.normalizedFilePath emptyPathUri "" -#else -emptyFilePath = LSP.NormalizedFilePath emptyPathUri "" -#endif +emptyFilePath = LSP.emptyNormalizedFilePath -- | We use an empty string as a filepath when we don’t have a file. -- However, haskell-lsp doesn’t support that in uriToFilePath and given diff --git a/hls-plugin-api/src/Ide/PluginUtils.hs b/hls-plugin-api/src/Ide/PluginUtils.hs index 209569a2bd..7b5753ffee 100644 --- a/hls-plugin-api/src/Ide/PluginUtils.hs +++ b/hls-plugin-api/src/Ide/PluginUtils.hs @@ -217,10 +217,7 @@ fullRange s = Range startPos endPos lastLine = fromIntegral $ length $ T.lines s subRange :: Range -> Range -> Bool -subRange smallRange range = _start smallRange >= _start range && _end smallRange <= _end range - -positionInRange :: Position -> Range -> Bool -positionInRange p (Range sp ep) = sp <= p && p < ep -- Range's end position is exclusive, see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#range +subRange = isSubrangeOf -- --------------------------------------------------------------------- From 5363f876fc102303df8e0721a5013d5b5b4e1aa2 Mon Sep 17 00:00:00 2001 From: kokobd Date: Sat, 27 Aug 2022 18:09:37 +0800 Subject: [PATCH 02/12] modify default benchmark config --- bench/config.yaml | 108 +++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/bench/config.yaml b/bench/config.yaml index 19e014a485..5783b7d7c5 100644 --- a/bench/config.yaml +++ b/bench/config.yaml @@ -76,7 +76,7 @@ versions: # - 1.8.0.0 -# - upstream: origin/master +- upstream: origin/master # - HEAD~1 - HEAD @@ -95,25 +95,27 @@ configurations: # The implicitly included plugins are: # - ghcide-core # - ghcide-hover-and-symbols -- None: [] -- Core: - - callHierarchy - - codeRange - - eval - - ghcide-code-actions-bindings - - ghcide-code-actions-fill-holes - - ghcide-code-actions-imports-exports - - ghcide-code-actions-type-signatures - - ghcide-completions - - ghcide-type-lenses - - pragmas -- Ghcide: - - ghcide-code-actions-bindings - - ghcide-code-actions-fill-holes - - ghcide-code-actions-imports-exports - - ghcide-code-actions-type-signatures - - ghcide-completions - - ghcide-type-lenses + +# Uncomment below sections if needed +# - None: [] +# - Core: +# - callHierarchy +# - codeRange +# - eval +# - ghcide-code-actions-bindings +# - ghcide-code-actions-fill-holes +# - ghcide-code-actions-imports-exports +# - ghcide-code-actions-type-signatures +# - ghcide-completions +# - ghcide-type-lenses +# - pragmas +# - Ghcide: +# - ghcide-code-actions-bindings +# - ghcide-code-actions-fill-holes +# - ghcide-code-actions-imports-exports +# - ghcide-code-actions-type-signatures +# - ghcide-completions +# - ghcide-type-lenses - All: - alternateNumberFormat - callHierarchy @@ -140,36 +142,36 @@ configurations: - refineImports - rename - stylish-haskell -- alternateNumberFormat -# - brittany -- callHierarchy -- changeTypeSignature -- class -- codeRange -- eval -- explicitFixity -# - floskell -# - fourmolu -- gadt -- ghcide-code-actions-bindings -- ghcide-code-actions-fill-holes -- ghcide-code-actions-imports-exports -- ghcide-code-actions-type-signatures -- ghcide-completions -# - ghcide-core # implicitly included in all configurations -# - ghcide-hover-and-symbols # implicitly included in all configurations -- ghcide-type-lenses -- haddockComments -- hlint -- importLens -- moduleName -# - ormolu -- pragmas -- qualifyImportedNames -- refineImports -- rename -- retrie -- splice -- stan -# - stylish-haskell -- tactics +# - alternateNumberFormat +# # - brittany +# - callHierarchy +# - changeTypeSignature +# - class +# - codeRange +# - eval +# - explicitFixity +# # - floskell +# # - fourmolu +# - gadt +# - ghcide-code-actions-bindings +# - ghcide-code-actions-fill-holes +# - ghcide-code-actions-imports-exports +# - ghcide-code-actions-type-signatures +# - ghcide-completions +# # - ghcide-core # implicitly included in all configurations +# # - ghcide-hover-and-symbols # implicitly included in all configurations +# - ghcide-type-lenses +# - haddockComments +# - hlint +# - importLens +# - moduleName +# # - ormolu +# - pragmas +# - qualifyImportedNames +# - refineImports +# - rename +# - retrie +# - splice +# - stan +# # - stylish-haskell +# - tactics From d435a41a05c4c82a3817b90e5c7e3f6649eb0ff6 Mon Sep 17 00:00:00 2001 From: kokobd Date: Mon, 29 Aug 2022 20:54:07 +0800 Subject: [PATCH 03/12] upgrade lsp --- cabal.project | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cabal.project b/cabal.project index 77e3a91652..5aee2af00e 100644 --- a/cabal.project +++ b/cabal.project @@ -70,19 +70,19 @@ source-repository-package type:git location: https://github.com/kokobd/lsp subdir: lsp - tag: 80ebd816454a9e44d4cd93793ef3badc661b0f2f + tag: 974d97c8fdbe067bf6fe31fae2046835c9717c6c source-repository-package type:git location: https://github.com/kokobd/lsp subdir: lsp-types - tag: 80ebd816454a9e44d4cd93793ef3badc661b0f2f + tag: 974d97c8fdbe067bf6fe31fae2046835c9717c6c source-repository-package type:git location: https://github.com/kokobd/lsp subdir: lsp-test - tag: 80ebd816454a9e44d4cd93793ef3badc661b0f2f + tag: 974d97c8fdbe067bf6fe31fae2046835c9717c6c allow-newer: -- ghc-9.2 From 19d87ffedf1dd239cad81f85c5ad5070dcd6d6df Mon Sep 17 00:00:00 2001 From: kokobd Date: Fri, 2 Sep 2022 16:35:26 +0800 Subject: [PATCH 04/12] use lsp master --- cabal.project | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cabal.project b/cabal.project index 5aee2af00e..885124d25e 100644 --- a/cabal.project +++ b/cabal.project @@ -68,21 +68,21 @@ source-repository-package -- Remove me when a new version of lsp is released source-repository-package type:git - location: https://github.com/kokobd/lsp + location: https://github.com/haskell/lsp subdir: lsp - tag: 974d97c8fdbe067bf6fe31fae2046835c9717c6c + tag: 78dc807159c5e0faa04704198d18f24ece3ebc96 source-repository-package type:git - location: https://github.com/kokobd/lsp + location: https://github.com/haskell/lsp subdir: lsp-types - tag: 974d97c8fdbe067bf6fe31fae2046835c9717c6c + tag: 78dc807159c5e0faa04704198d18f24ece3ebc96 source-repository-package type:git - location: https://github.com/kokobd/lsp + location: https://github.com/haskell/lsp subdir: lsp-test - tag: 974d97c8fdbe067bf6fe31fae2046835c9717c6c + tag: 78dc807159c5e0faa04704198d18f24ece3ebc96 allow-newer: -- ghc-9.2 From fc3d8f7a251abb86dc61f983d8241c607b919e17 Mon Sep 17 00:00:00 2001 From: kokobd Date: Fri, 2 Sep 2022 19:43:55 +0800 Subject: [PATCH 05/12] temp: compare benchmark with previous commit --- bench/config.yaml | 1 + cabal.project | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bench/config.yaml b/bench/config.yaml index 5783b7d7c5..14977ccbb2 100644 --- a/bench/config.yaml +++ b/bench/config.yaml @@ -79,6 +79,7 @@ versions: - upstream: origin/master # - HEAD~1 - HEAD +- 19d87ffedf1dd239cad81f85c5ad5070dcd6d6df # A list of plugin configurations to analyze configurations: diff --git a/cabal.project b/cabal.project index 885124d25e..239fcf6330 100644 --- a/cabal.project +++ b/cabal.project @@ -68,21 +68,21 @@ source-repository-package -- Remove me when a new version of lsp is released source-repository-package type:git - location: https://github.com/haskell/lsp + location: https://github.com/kokobd/lsp subdir: lsp - tag: 78dc807159c5e0faa04704198d18f24ece3ebc96 + tag: 77a434087b1f39ae6fd4bc6d88fddbcd1d23e185 source-repository-package type:git - location: https://github.com/haskell/lsp + location: https://github.com/kokobd/lsp subdir: lsp-types - tag: 78dc807159c5e0faa04704198d18f24ece3ebc96 + tag: 77a434087b1f39ae6fd4bc6d88fddbcd1d23e185 source-repository-package type:git - location: https://github.com/haskell/lsp + location: https://github.com/kokobd/lsp subdir: lsp-test - tag: 78dc807159c5e0faa04704198d18f24ece3ebc96 + tag: 77a434087b1f39ae6fd4bc6d88fddbcd1d23e185 allow-newer: -- ghc-9.2 From 3fa185807dd80ca0fa8c80f8751531e8700b1bb5 Mon Sep 17 00:00:00 2001 From: kokobd Date: Sat, 3 Sep 2022 19:05:01 +0800 Subject: [PATCH 06/12] use text in NormalizedFilePath --- bench/config.yaml | 1 - cabal.project | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bench/config.yaml b/bench/config.yaml index fba7863930..9e49ed6360 100644 --- a/bench/config.yaml +++ b/bench/config.yaml @@ -79,7 +79,6 @@ versions: - upstream: origin/master # - HEAD~1 - HEAD -- 19d87ffedf1dd239cad81f85c5ad5070dcd6d6df # A list of plugin configurations to analyze configurations: diff --git a/cabal.project b/cabal.project index 54a9c0bdc9..9b9a9b1e05 100644 --- a/cabal.project +++ b/cabal.project @@ -86,19 +86,19 @@ source-repository-package type:git location: https://github.com/kokobd/lsp subdir: lsp - tag: 77a434087b1f39ae6fd4bc6d88fddbcd1d23e185 + tag: 3b7c659bbe50a9ea93ce66a55fba43404fa6d6ef source-repository-package type:git location: https://github.com/kokobd/lsp subdir: lsp-types - tag: 77a434087b1f39ae6fd4bc6d88fddbcd1d23e185 + tag: 3b7c659bbe50a9ea93ce66a55fba43404fa6d6ef source-repository-package type:git location: https://github.com/kokobd/lsp subdir: lsp-test - tag: 77a434087b1f39ae6fd4bc6d88fddbcd1d23e185 + tag: 3b7c659bbe50a9ea93ce66a55fba43404fa6d6ef allow-newer: -- ghc-9.4 From b33c7826b7ff9a4845b316b5bef999b5de4892c8 Mon Sep 17 00:00:00 2001 From: kokobd Date: Sun, 4 Sep 2022 22:00:34 +0800 Subject: [PATCH 07/12] upgrade to lsp master --- cabal.project | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cabal.project b/cabal.project index 9b9a9b1e05..610f77689a 100644 --- a/cabal.project +++ b/cabal.project @@ -84,21 +84,21 @@ source-repository-package -- Remove me when a new version of lsp is released source-repository-package type:git - location: https://github.com/kokobd/lsp + location: https://github.com/haskell/lsp subdir: lsp - tag: 3b7c659bbe50a9ea93ce66a55fba43404fa6d6ef + tag: b0f8596887088b8ab65fc1015c773f45b47234ae source-repository-package type:git - location: https://github.com/kokobd/lsp + location: https://github.com/haskell/lsp subdir: lsp-types - tag: 3b7c659bbe50a9ea93ce66a55fba43404fa6d6ef + tag: b0f8596887088b8ab65fc1015c773f45b47234ae source-repository-package type:git - location: https://github.com/kokobd/lsp + location: https://github.com/haskell/lsp subdir: lsp-test - tag: 3b7c659bbe50a9ea93ce66a55fba43404fa6d6ef + tag: b0f8596887088b8ab65fc1015c773f45b47234ae allow-newer: -- ghc-9.4 From 5db0317c0fc76a4b3e9037e4dfab526a4dc3282b Mon Sep 17 00:00:00 2001 From: kokobd Date: Mon, 5 Sep 2022 03:33:12 +0800 Subject: [PATCH 08/12] fix stack config --- stack-lts16.yaml | 9 ++++++--- stack-lts19.yaml | 9 ++++++--- stack.yaml | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/stack-lts16.yaml b/stack-lts16.yaml index 50120b1841..666089e558 100644 --- a/stack-lts16.yaml +++ b/stack-lts16.yaml @@ -87,9 +87,12 @@ extra-deps: - constraints-extras-0.3.0.2@sha256:013b8d0392582c6ca068e226718a4fe8be8e22321cc0634f6115505bf377ad26,1853 - some-1.0.1@sha256:26e5bab7276f48b25ea8660d3fd1166c0f20fd497dac879a40f408e23211f93e,2055 - unliftio-core-0.2.0.1@sha256:9b3e44ea9aacacbfc35b3b54015af450091916ac3618a41868ebf6546977659a,1082 - - lsp-1.5.0.0 - - lsp-types-1.5.0.0 - - lsp-test-0.14.0.3 + - git: git@github.com:haskell/lsp + commit: b0f8596887088b8ab65fc1015c773f45b47234ae + subdirs: + - lsp + - lsp-types + - lsp-test - stm-containers-1.1.0.4 - stm-hamt-1.2.0.6@sha256:fba86ccb4b45c5706c19b0e1315ba63dcac3b5d71de945ec001ba921fae80061,3972 - primitive-extras-0.10.1 diff --git a/stack-lts19.yaml b/stack-lts19.yaml index c13433ac13..d73ec71973 100644 --- a/stack-lts19.yaml +++ b/stack-lts19.yaml @@ -55,9 +55,12 @@ extra-deps: - refinery-0.4.0.0@sha256:fe3a43add8ff1db5cfffee7e7694c86128b1dfe62c541f26e25a8eadf9585610,1663 - retrie-1.1.0.0 - stylish-haskell-0.14.2.0@sha256:fffe1c13ad4c2678cf28a7470cac5d3bf20c71c36f09969e3e5f186787cceb7c,4321 -- lsp-1.5.0.0 -- lsp-types-1.5.0.0 -- lsp-test-0.14.0.3 +- git: git@github.com:haskell/lsp + commit: b0f8596887088b8ab65fc1015c773f45b47234ae + subdirs: + - lsp + - lsp-types + - lsp-test - co-log-core-0.3.1.0 configure-options: diff --git a/stack.yaml b/stack.yaml index 5a0649322a..75e17da1a3 100644 --- a/stack.yaml +++ b/stack.yaml @@ -41,9 +41,12 @@ extra-deps: - hiedb-0.4.1.0@sha256:fb20c657d9ecc91701b00dffcf4bbd77cb83720a1f9d867badd77ea227973135,2875 - implicit-hie-0.1.2.7@sha256:82bbbb1a8c05f99c8af3c16ac53e80c8648d8bf047b25ed5ce45a135bd736907,3122 - implicit-hie-cradle-0.5.0.0@sha256:4276f60f3a59bc22df03fd918f73bca9f777de9568f85e3a8be8bd7566234a59,2368 -- lsp-1.5.0.0 -- lsp-test-0.14.0.3 -- lsp-types-1.5.0.0 +- git: git@github.com:haskell/lsp + commit: b0f8596887088b8ab65fc1015c773f45b47234ae + subdirs: + - lsp + - lsp-types + - lsp-test - monad-dijkstra-0.1.1.3@sha256:d2fc098d7c122555e726830a12ae0423ac187f89de9228f32e56e2f6fc2238e1,1900 - retrie-1.2.0.1 - co-log-core-0.3.1.0 From 85e21728be070c430ab4703d66429fdc595d11ce Mon Sep 17 00:00:00 2001 From: kokobd Date: Mon, 5 Sep 2022 03:33:58 +0800 Subject: [PATCH 09/12] remove obsolete dir form ghcide.cabal --- ghcide/ghcide.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghcide/ghcide.cabal b/ghcide/ghcide.cabal index 0329130c88..d4fab31b3c 100644 --- a/ghcide/ghcide.cabal +++ b/ghcide/ghcide.cabal @@ -378,7 +378,7 @@ test-suite ghcide-tests record-hasfield if impl(ghc < 9.3) build-depends: ghc-typelits-knownnat - hs-source-dirs: test/cabal test/exe test/src bench/lib + hs-source-dirs: test/cabal test/exe test/src ghc-options: -threaded -Wall -Wno-name-shadowing -O0 -Wno-unticked-promoted-constructors main-is: Main.hs other-modules: From 1c2a11df9d234fd3bd919c10dfadc9a50cb168db Mon Sep 17 00:00:00 2001 From: kokobd Date: Wed, 7 Sep 2022 12:52:03 +0800 Subject: [PATCH 10/12] run pre-commit without args --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index af9f4981af..96438bab59 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -40,3 +40,5 @@ jobs: - uses: actions/setup-python@v4 - uses: pre-commit/action@v3.0.0 + with: + extra_args: "" From 2bb1c1911fc46737c1759534506f3c1d1fd8058d Mon Sep 17 00:00:00 2001 From: kokobd Date: Wed, 7 Sep 2022 13:13:24 +0800 Subject: [PATCH 11/12] Revert "run pre-commit without args" This reverts commit 1c2a11df9d234fd3bd919c10dfadc9a50cb168db. --- .github/workflows/pre-commit.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 96438bab59..af9f4981af 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -40,5 +40,3 @@ jobs: - uses: actions/setup-python@v4 - uses: pre-commit/action@v3.0.0 - with: - extra_args: "" From 52560235b5f54afd930c572cfb6ef429be6e408c Mon Sep 17 00:00:00 2001 From: kokobd Date: Fri, 9 Sep 2022 00:39:05 +0800 Subject: [PATCH 12/12] remove unnecessary tests --- hls-plugin-api/test/Ide/PluginUtilsTest.hs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/hls-plugin-api/test/Ide/PluginUtilsTest.hs b/hls-plugin-api/test/Ide/PluginUtilsTest.hs index c6bedfdf28..f868a067d1 100644 --- a/hls-plugin-api/test/Ide/PluginUtilsTest.hs +++ b/hls-plugin-api/test/Ide/PluginUtilsTest.hs @@ -9,21 +9,5 @@ import Test.Tasty.HUnit tests :: TestTree tests = testGroup "PluginUtils" - [ positionInRangeTest - ] - -positionInRangeTest :: TestTree -positionInRangeTest = testGroup "positionInRange" - [ testCase "single line, after the end" $ - positionInRange (Position 1 10) (Range (Position 1 1) (Position 1 3)) @?= False - , testCase "single line, before the begining" $ - positionInRange (Position 1 0) (Range (Position 1 1) (Position 1 6)) @?= False - , testCase "single line, in range" $ - positionInRange (Position 1 5) (Range (Position 1 1) (Position 1 6)) @?= True - , testCase "single line, at the end" $ - positionInRange (Position 1 5) (Range (Position 1 1) (Position 1 5)) @?= False - , testCase "multiline, in range" $ - positionInRange (Position 3 5) (Range (Position 1 1) (Position 5 6)) @?= True - , testCase "multiline, out of range" $ - positionInRange (Position 3 5) (Range (Position 3 6) (Position 4 10)) @?= False + [ ]