Skip to content

Commit

Permalink
feat(functions): add methods for UI display filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
hinell committed Oct 19, 2023
1 parent a2363e3 commit 5d3a59f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/legendary/data/function.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,19 @@ function Function:frecency_id()
return string.format('<function> %s', self.description)
end

--- Intended to be used by UI filters
function Function:modeSwitched()
return self._mode_switched
end

function Function:modes()
if self:modeSwitched() then
return self.mode_mappings
else
-- Just use all modes for UI filtering
-- it's half-assed because UI filtering is ugly ¯\_(ツ)_/¯
return { 'n', 'V', 'v', 'x', 's', 'o', '' }
end
end

return Function

0 comments on commit 5d3a59f

Please sign in to comment.