Skip to content

Commit

Permalink
remove element_lit in favour of get_node_root
Browse files Browse the repository at this point in the history
  • Loading branch information
armed committed Aug 20, 2023
1 parent a30dcd6 commit aab724a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,6 @@ require("nvim-paredit").setup({
-- This is the inverse of `get_node_root` for forms and should find the inner node for which
-- the forms elements are direct children.
--
-- In some languages (i.e. clojure) elements consists of several parts
-- keyword has up to three parts
-- :foo/hello is represented as:
-- kwd_lit (":")
-- namespace: kwd_ns ("foo")
-- name: kwd_name ("hello")
-- this function should return whole element, in this case kwd_lit
element_lit = function(node)
end,
--
-- For example given the node `'()` or 'quoting_lit', this function should return `()` or 'list_lit'.
unwrap_form = function(node)
end,
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-paredit/api/wrap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end
function M.find_element_under_cursor(lang)
local node = ts.get_node_at_cursor()
if lang.element_lit then
return lang.element_lit(node)
return lang.get_node_root(node)
end
return node
end
Expand Down
10 changes: 0 additions & 10 deletions lua/nvim-paredit/lang/clojure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ function M.get_node_root(node)
return traversal.find_root_element_relative_to(root, node)
end

function M.element_lit(node)
local lit = node
if lit then
if not lit:type():match("lit$") then
lit = M.element_lit(lit:parent())
end
end
return lit
end

function M.unwrap_form(node)
if common.included_in_table(form_types, node:type()) then
return node
Expand Down

0 comments on commit aab724a

Please sign in to comment.