Skip to content

Commit

Permalink
feat(watcher): symbol queries for haskell and rust (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Feb 2, 2024
1 parent 73043d6 commit b47c992
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
39 changes: 39 additions & 0 deletions lua/neotest/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,45 @@ local default_config = {
name: (constant) @symbol))
)
]],
rust = [[
;query
;submodule import
(mod_item
name: (identifier) @symbol)
;single import
(use_declaration
argument: (scoped_identifier
name: (identifier) @symbol))
;import list
(use_declaration
argument: (scoped_use_list
list: (use_list
[(scoped_identifier
path: (identifier)
name: (identifier) @symbol)
((identifier) @symbol)])))
;wildcard import
(use_declaration
argument: (scoped_use_list
path: (identifier)
[(use_list
[(scoped_identifier
path: (identifier)
name: (identifier) @symbol)
((identifier) @symbol)
])]))
]],
haskell = [[
;query
;explicit import
((import_item [(variable)]) @symbol)
;symbols that may be imported implicitly
((type) @symbol)
(qualified_variable (variable) @symbol)
(exp_apply (exp_name (variable) @symbol))
((constructor) @symbol)
((operator) @symbol)
]],
},
filter_path = nil,
},
Expand Down
5 changes: 4 additions & 1 deletion lua/neotest/consumers/watch/watcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ function Watcher:_get_linked_files(path, root_path, args)
end

for _, def in ipairs(defs or {}) do
dependency_uris[def.uri or def.targetUri] = true
local index = def.uri or def.targetUri
if index then
dependency_uris[def.uri or def.targetUri] = true
end
end
end
local paths = { path }
Expand Down

0 comments on commit b47c992

Please sign in to comment.