@@ -163,18 +163,20 @@ A **project scope** is determined by means of a
163
163
- `global ` : tags are scoped to a global namespace
164
164
- `static ` : tags are scoped to neovim’s initial working directory
165
165
- `directory ` : tags are scoped to the current working directory
166
- - `git` : tags are scoped to the current git repository, **fallback**: `static `
167
166
- `lsp ` : tags are scoped using the `root_dir` of the current buffer’s attached LSP server, **fallback**: `static `
167
+ - `git` : tags are scoped to the current git repository, **fallback**: `static `
168
+ - `git_branch` : tags are scoped to the current git repository and branch, **fallback**: `static `
168
169
169
170
170
- There are two additional scope resolvers which should be preferred when
171
+ There are three additional scope resolvers which should be preferred when
171
172
creating a **| grapple.nvim-fallback-scope-resolver | **. These resolvers act
172
173
identically to their similarly named counterparts, but do not have default
173
174
fallbacks.
174
175
175
176
176
- - `git_fallback` : the same as `git` , but without a fallback
177
177
- `lsp_fallback` : the same as `lsp ` , but without a fallback
178
+ - `git_fallback` : the same as `git` , but without a fallback
179
+ - `git_branch_suffix` : resolves suffix (branch) for `git_branch`
178
180
179
181
180
182
It is also possible to create your own **custom scope resolver**. For the
@@ -187,7 +189,7 @@ available scope resolver types, please see the Scope API in
187
189
>
188
190
-- Setup using a builtin scope resolver
189
191
require("grapple").setup({
190
- scope = require("grapple").resolvers.static
192
+ scope = require("grapple").resolvers.git
191
193
})
192
194
193
195
-- Setup using a custom scope resolver
@@ -498,7 +500,8 @@ Scope API
498
500
499
501
**`returns` **: | grapple.nvim-`grapple.scoperesolver` |
500
502
501
- **`scope_callback` **: | grapple.nvim-`grapple.scopefunction` |
503
+ **`scope_callback` **: | grapple.nvim-`grapple.scopefunction` | |
504
+ | grapple.nvim-`grapple.scopejob` |
502
505
503
506
**`opts?` **: | grapple.nvim-`grapple.scopeoptions` |
504
507
@@ -515,6 +518,17 @@ Scope API
515
518
require("grapple.scope").resolver(function()
516
519
return vim.fn.getcwd()
517
520
end, { cache = "DirChanged" })
521
+
522
+ -- Create an scope resolver that asynchronously runs the "echo"
523
+ -- shell command and uses its output as the resolved scope
524
+ require("grapple.scope").resolver({
525
+ command = "echo",
526
+ args = [ "hello_world" ],
527
+ cwd = vim.fn.getcwd(),
528
+ on_exit = function(job, return_value)
529
+ return job:result()[1]
530
+ end
531
+ })
518
532
<
519
533
520
534
0 commit comments