2022-05-16 22:20:10 +08:00
|
|
|
local state = {}
|
|
|
|
|
|
|
|
TelescopeGlobalState = TelescopeGlobalState or {}
|
|
|
|
TelescopeGlobalState.global = TelescopeGlobalState.global or {}
|
|
|
|
|
|
|
|
--- Set the status for a particular prompt bufnr
|
|
|
|
function state.set_status(prompt_bufnr, status)
|
|
|
|
TelescopeGlobalState[prompt_bufnr] = status
|
|
|
|
end
|
|
|
|
|
|
|
|
function state.set_global_key(key, value)
|
|
|
|
TelescopeGlobalState.global[key] = value
|
|
|
|
end
|
|
|
|
|
|
|
|
function state.get_global_key(key)
|
|
|
|
return TelescopeGlobalState.global[key]
|
|
|
|
end
|
|
|
|
|
|
|
|
function state.get_status(prompt_bufnr)
|
|
|
|
return TelescopeGlobalState[prompt_bufnr] or {}
|
|
|
|
end
|
|
|
|
|
|
|
|
function state.clear_status(prompt_bufnr)
|
|
|
|
state.set_status(prompt_bufnr, nil)
|
|
|
|
end
|
|
|
|
|
2024-02-23 15:35:33 +08:00
|
|
|
function state.get_existing_prompts()
|
|
|
|
return vim.tbl_keys(TelescopeGlobalState)
|
2022-05-16 22:20:10 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return state
|