We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, there's no Lua API for knowing whether the plugin is enabled. I have to get the upvalue for tsc.toggle to query this.
tsc.toggle
-- Get up value for {func}'s {name} variable. ---@generic T ---@param func fun(...):T ---@param name string ---@return unknown? ---@nodiscard function M.get_upvalue(func, name) local i = 1 while true do local n, v = debug.getupvalue(func, i) if n == nil then return nil end if n == name then return v end i = i + 1 end end local function toggle_context() local util = require("util") local tsc = require("treesitter-context") tsc.toggle() if util.get_upvalue(tsc.toggle, "enabled") then util.log.info("Enabled treesitter context", "Option") else util.log.warn("Disabled treesitter context", "Option") end end
Having a function like tsc.status() would be really helpful.
tsc.status()
The text was updated successfully, but these errors were encountered:
Why do you need to know if the plugin is enabled?
Sorry, something went wrong.
I wanted to show a UI message based on whether the context was enabled or not.
No branches or pull requests
Currently, there's no Lua API for knowing whether the plugin is enabled. I have to get the upvalue for
tsc.toggle
to query this.Having a function like
tsc.status()
would be really helpful.The text was updated successfully, but these errors were encountered: