diff --git a/CHANGELOG.md b/CHANGELOG.md index 244ebe1..5008863 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.4.0 + +- Answer textDocument/documentSymbol for a notebook, which came back empty because every cell symbol hangs off the projection's synthetic class + ## 0.1.3.0 - Write the shadow document to disk before the server is told about it, which jdtls needs to answer a goto diff --git a/java-notebook-language-server.cabal b/java-notebook-language-server.cabal index e7bad3b..676c9a8 100644 --- a/java-notebook-language-server.cabal +++ b/java-notebook-language-server.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: java-notebook-language-server -version: 0.1.3.0 +version: 0.1.4.0 build-type: Simple extra-source-files: README.md diff --git a/package.yaml b/package.yaml index ed1ab99..7e834da 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: java-notebook-language-server -version: 0.1.3.0 +version: 0.1.4.0 extra-source-files: - README.md diff --git a/stack.yaml b/stack.yaml index 5d14ff1..3f87b18 100644 --- a/stack.yaml +++ b/stack.yaml @@ -10,7 +10,7 @@ system-ghc: true extra-deps: - git: https://github.com/codedownio/notebook-language-server-core.git - commit: 7ad5b8aa8f48a608ff1706f1441846d2d1ef3033 + commit: 097e5461f2908dcb12d110b2fa015be96df5b9db - git: https://github.com/codedownio/sandwich # long-running-nodes branch diff --git a/stack.yaml.lock b/stack.yaml.lock index 90f1630..4e0ada1 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -5,15 +5,15 @@ packages: - completed: - commit: 7ad5b8aa8f48a608ff1706f1441846d2d1ef3033 + commit: 097e5461f2908dcb12d110b2fa015be96df5b9db git: https://github.com/codedownio/notebook-language-server-core.git name: notebook-language-server-core pantry-tree: - sha256: 8efdde8eaa3ff74536df7db3078f57ac5af00606b9129e48e576b37fffe030da - size: 3032 + sha256: 655551f233c4e1a8e3b9b53628174b588fc1c4db06c4786bfb3a54098600522a + size: 3264 version: 0.1.0.0 original: - commit: 7ad5b8aa8f48a608ff1706f1441846d2d1ef3033 + commit: 097e5461f2908dcb12d110b2fa015be96df5b9db git: https://github.com/codedownio/notebook-language-server-core.git - completed: commit: c3e16ccda384917fba1ccc5f3cf8f592415562c1 diff --git a/test/Test/Notebook.hs b/test/Test/Notebook.hs index cf041b0..596a6c2 100644 --- a/test/Test/Notebook.hs +++ b/test/Test/Notebook.hs @@ -17,7 +17,7 @@ import Control.Lens ((^.)) import Data.String.Interpolate import Data.Text (Text) import qualified Data.Text as T -import Language.LSP.Protocol.Lens (label, message, range) +import Language.LSP.Protocol.Lens (label, message, name, range) import Language.LSP.Protocol.Types import Test.Sandwich import Test.Sandwich.Contexts.Files @@ -101,3 +101,20 @@ spec = describe "Notebook" $ do case [d ^. range | d <- diagnostics, "never used" `T.isInfixOf` (d ^. message)] of (r : _) -> r `shouldBe` Range (Position 0 7) (Position 0 21) [] -> expectationFailure [i|No unused-import diagnostic in: #{diagnostics}|] + + -- jdtls answers with the projection's tree: everything hangs off the synthetic __Cells + -- class, which spans lines no cell owns. Core replaces a node it can't place with its + -- children, so the method surfaces at the top rather than the whole outline vanishing. + it "outlines a method declared in the notebook" $ do + doNotebookSession cells $ \(Helpers.LspSessionInfo {..}) -> do + doc <- LSP.openDoc lspSessionInfoFileName LanguageKind_Java + + waitUntil 300 $ do + symbols <- LSP.getDocumentSymbols doc + info [i|Got document symbols: #{symbols}|] + case symbols of + Right documentSymbols -> + [(s ^. name, s ^. range) | s <- documentSymbols] + `listShouldContain` ("doubled(int)", Range (Position 4 0) (Position 6 1)) + Left symbolInformations -> + expectationFailure [i|Expected a document symbol tree, got: #{symbolInformations}|]