local M = {} ---@type fun(msg: string, level: integer) M.notify = vim.schedule_wrap( function(msg, level) vim.notify(msg, level, { title = "jjannotate.nvim" }) end ) ---@param subject string ---@param revision jjannotate.RevisionRef ---@return string function M.revision_uri(subject, revision) return string.format( "jjannotate://%s/%s/%s?repo=%s", subject, revision.change_id, revision.path, revision.repo ) end ---@param subject string ---@param uri string ---@return jjannotate.RevisionRef? function M.parse_uri(subject, uri) local _, _, change_id, rest = uri:find(string.format("jjannotate://%s/([^/]+)/(.+)", subject)) if not change_id or not rest then return nil end local path, repo = rest:match("^(.+)%?repo=(.+)$") if not path or not repo then return nil end return { repo = repo, change_id = change_id, path = path } end return M