File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
plugins/hls-notes-plugin/src/Ide/Plugin Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -84,13 +84,15 @@ jumpToNote state _ param
8484 =<< lift (LSP. getVirtualFile uriOrig)
8585 line <- err " Line not found in file" (listToMaybe $ Rope. lines $ fst
8686 (Rope. splitAtLine 1 $ snd $ Rope. splitAtLine (fromIntegral l) contents))
87- note <- err " No note at this position" $ listToMaybe $
88- mapMaybe (atPos $ fromIntegral c) $ matchAllText noteRefRegex line
89- notes <- runActionE " notes.definedNotes" state $ useE MkGetNotes nfp
90- (noteFp, pos) <- err (" Note definition (a comment of the form `{- Note [" <> note <> " ]\\ n~~~ ... -}`) not found" ) (HM. lookup note notes)
91- pure $ InL (Definition (InL
92- (Location (fromNormalizedUri $ normalizedFilePathToUri noteFp) (Range pos pos))
93- ))
87+ let noteOpt = listToMaybe $ mapMaybe (atPos $ fromIntegral c) $ matchAllText noteRefRegex line
88+ case noteOpt of
89+ Nothing -> pure (InR (InR Null ))
90+ Just note -> do
91+ notes <- runActionE " notes.definedNotes" state $ useE MkGetNotes nfp
92+ (noteFp, pos) <- err (" Note definition (a comment of the form `{- Note [" <> note <> " ]\\ n~~~ ... -}`) not found" ) (HM. lookup note notes)
93+ pure $ InL (Definition (InL
94+ (Location (fromNormalizedUri $ normalizedFilePathToUri noteFp) (Range pos pos))
95+ ))
9496 where
9597 uriOrig = toNormalizedUri $ param ^. (L. textDocument . L. uri)
9698 err s = maybe (throwError $ PluginInternalError s) pure
You can’t perform that action at this time.
0 commit comments