Skip to content

Commit 51aedf3

Browse files
committed
hls-notes-plugin: Address review comments
1 parent 3c6d8fc commit 51aedf3

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
(pkgs.haskell.lib.justStaticExecutables (pkgs.haskell.lib.dontCheck pkgs.haskellPackages.opentelemetry-extra))
7070
capstone
7171
# ormolu
72-
# stylish-haskell
72+
stylish-haskell
7373
pre-commit
7474
] ++ lib.optionals (!stdenv.isDarwin)
7575
[ # tracy has a build problem on macos.

plugins/hls-notes-plugin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ main = do
1616
```
1717

1818
Foo.hs
19-
```
19+
```haskell
2020
module Foo where
2121

2222
doSomething :: IO ()
@@ -29,4 +29,4 @@ Some very important explanation
2929
-}
3030
```
3131

32-
Using "Go-to-definition on the Note reference in `Main.hs` will jump to the beginning of the note in `Foo.hs`.
32+
Using "Go-to-definition" on the Note reference in `Main.hs` will jump to the beginning of the note in `Foo.hs`.

plugins/hls-notes-plugin/src/Ide/Plugin/Notes.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Ide.Plugin.Notes (descriptor, Log) where
22

3-
import Control.Lens (ix, (^.), (^?))
3+
import Control.Lens ((^.))
44
import Control.Monad.Except (throwError)
55
import Control.Monad.IO.Class (liftIO)
66
import Control.Monad.Trans (lift)
@@ -82,7 +82,8 @@ jumpToNote state _ param
8282
let Position l c = param ^. L.position
8383
contents <- fmap _file_text . err "Error getting file contents"
8484
=<< lift (LSP.getVirtualFile uriOrig)
85-
line <- err "Line not found in file" (Rope.lines contents ^? ix (fromIntegral l))
85+
line <- err "Line not found in file" (listToMaybe $ Rope.lines $ fst
86+
(Rope.splitAtLine 1 $ snd $ Rope.splitAtLine (fromIntegral l) contents))
8687
note <- err "No note at this position" $ listToMaybe $
8788
mapMaybe (atPos $ fromIntegral c) $ matchAllText noteRefRegex line
8889
notes <- runActionE "notes.definedNotes" state $ useE MkGetNotes nfp

0 commit comments

Comments
 (0)