|
1 |
| -*grapple.nvim.txt* For NVIM v0.8.0 Last change: 2023 March 01 |
| 1 | +*grapple.nvim.txt* For NVIM v0.8.0 Last change: 2023 March 04 |
2 | 2 |
|
3 | 3 | ==============================================================================
|
4 | 4 | Table of Contents *grapple.nvim-table-of-contents*
|
@@ -497,6 +497,42 @@ guarantee that a scope is found.
|
497 | 497 | <
|
498 | 498 |
|
499 | 499 |
|
| 500 | +GRAPPLE.SCOPEROOT_FROM_BUFFER |
| 501 | + |
| 502 | +Create a scope resolver that generates a project scope by looking upwards for |
| 503 | +directories containing a specific file or directory _from the current buffer_. |
| 504 | + |
| 505 | +**API**`require("grapple.scope").root(root_names, opts)` |
| 506 | + |
| 507 | +**returns**|grapple.nvim-`grapple.scoperesolver`| |
| 508 | + |
| 509 | +**root_names**`string` | `string[]` |
| 510 | + |
| 511 | +**opts?**|grapple.nvim-`grapple.scopeoptions`| |
| 512 | + |
| 513 | + |
| 514 | +- **cache?**`boolean` | `string` | `string[]` | `integer` (default: `"BufEnter"`) |
| 515 | +- **persist?**`boolean` (default: `true`) |
| 516 | + |
| 517 | +**Note**it is recommended to use this with a **fallback scope resolver** to |
| 518 | +guarantee that a scope is found. |
| 519 | + |
| 520 | +**Example** |
| 521 | + |
| 522 | +>lua |
| 523 | + -- Create a buffer-based root scope resolver that looks for a directory |
| 524 | + -- containing a "Cargo.toml" file |
| 525 | + require("grapple.scope").root_from_buffer("Cargo.toml") |
| 526 | + |
| 527 | + -- Create a buffer-based root scope resolver that falls back to using |
| 528 | + -- the initial working directory for your neovim session |
| 529 | + require("grapple.scope").fallback({ |
| 530 | + require("grapple.scope").root_from_buffer("Cargo.toml"), |
| 531 | + require("grapple").resolvers.static, |
| 532 | + }) |
| 533 | +< |
| 534 | + |
| 535 | + |
500 | 536 | GRAPPLE.SCOPEFALLBACK
|
501 | 537 |
|
502 | 538 | Create a scope resolver that generates a project scope by attempting to get the
|
|
0 commit comments