Skip to content

nvim_buf_get_extmark_by_id has the wrong type when asking for details #106

@isovector

Description

@isovector

When nvim_buf_get_extmark_by_id is called with a map containing {"details ": true}, it also returns the details object. But nvim-hs is expecting to parse the result as Vector Int64, which isn't true :)

The following snippet crashes nvim-hs:

getExtmarkIntervalById :: Int64 -> Buffer -> Int64 -> Neovim env ()
getExtmarkIntervalById ns b x = do
  !z <- fmap V.toList $ nvim_buf_get_extmark_by_id b ns x $ M.singleton "details" $ ObjectBool True
  pure ()

with the error

ErrorMessage Expected any Integer value, but got ObjectMap (fromList [(ObjectString "end_col", ObjectInt 19) ....)])

A better type here I think would be:

nvim_buf_get_extmark_by_id :: Buffer -> Int64 -> Int64 -> Map Text Object -> forall env. Neovim env (Int64, Maybe (Map Text Object))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugupstreamworkaroundIssue has a work around mentioned in the discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions