-
Notifications
You must be signed in to change notification settings - Fork 33
Project Scopes
Calvin Bochulak edited this page Dec 7, 2022
·
1 revision
Pass cache = true (default) to never reset the project scope once it has been resolved.
require("grapple.scope").resolver(function()
return vim.fn.getcwd()
end, { cache = true })Pass cache = false to never cache the project scope.
require("grapple.scope").resolver(function()
return vim.fn.getcwd()
end, { cache = false })Pass in key = {key} to allow for manually invalidating a cached scope.
local resolver = require("grapple.scope").resolver(function()
return vim.fn.getcwd()
end, { key = "my_resolver" })
-- Invalidate using the resolver's key name
require("grapple.scope").invalidate("my_resolver")
-- Invalidate using the resolver's key
require("grapple.scope").invalidate(resolver.key)Pass cache = {event} or cache = { {event}, ... } to invalidate the cached scope when one or more autocommand events are triggered.
require("grapple.scope").resolver(function()
return vim.fn.getcwd()
end, { cache = "DirChanged" })require("grapple.scope").resolver(function()
return vim.fn.getcwd()
end, { cache = { "DirChanged", "FileType" } })