diff --git a/lua/hidesig.lua b/lua/hidesig.lua index 0a09f4e..3c661f5 100644 --- a/lua/hidesig.lua +++ b/lua/hidesig.lua @@ -7,7 +7,7 @@ function M.init() hidesig = { module_path = "hidesig.main", is_supported = function(lang) - local isSupported = queries.get_query(lang, "sig_def") ~= nil + local isSupported = queries.get_query(lang, "sorbet") ~= nil return isSupported end, opacity = 0.75 diff --git a/lua/hidesig/internal.lua b/lua/hidesig/internal.lua index 678c6b5..d85a8d9 100644 --- a/lua/hidesig/internal.lua +++ b/lua/hidesig/internal.lua @@ -68,7 +68,7 @@ function hidesig.highlightLines(bufnr, range, tree, lang, opacity) end local rootNode = tree:root() - local parsedQuery = ts_query.get_query(lang, "sig_def") + local parsedQuery = ts_query.get_query(lang, "sorbet") local startRow = range[1] local endRow = range[2] @@ -76,7 +76,7 @@ function hidesig.highlightLines(bufnr, range, tree, lang, opacity) vim.api.nvim_buf_clear_namespace(bufnr, namespace, startRow, endRow) for _, captures in parsedQuery:iter_matches(rootNode, bufnr, startRow, endRow) do - local sigBlock = captures[2] -- capture @sig_def + local sigBlock = captures[2] -- capture @sorbet if sigBlock ~= nil and not sigBlock:has_error() then for rootChildNode in sigBlock:iter_children() do diff --git a/queries/ruby/sig_def.scm b/queries/ruby/sig_def.scm deleted file mode 100644 index 1db120a..0000000 --- a/queries/ruby/sig_def.scm +++ /dev/null @@ -1,6 +0,0 @@ -( - call - method: (identifier) @sig_keyword - block: [(block) (do_block)] - (#eq? @sig_keyword "sig") -) @sig_def diff --git a/queries/ruby/sorbet.scm b/queries/ruby/sorbet.scm new file mode 100644 index 0000000..0ea4c33 --- /dev/null +++ b/queries/ruby/sorbet.scm @@ -0,0 +1,17 @@ +( + call + method: (identifier) @sig_keyword + block: [(block) (do_block)] + (#eq? @sig_keyword "sig") +) @sorbet + +( + assignment + left: (constant) + right: ( + call + receiver: (constant) + method: (identifier) @alias_identifier + (#eq? @alias_identifier "type_alias") + ) +) @sorbet