rust/crates/ide-db/src
bors da9c0bd0a7 Auto merge of #14442 - DropDemBits:structured-snippet-api, r=Veykril
internal: Implement Structured API for snippets

Fixes #11638 (including moving the cursor before the generated type parameter)

Adds `add_tabstop_{before,after}` for inserting tabstop snippets before & after nodes, and `add_placeholder_snippet` for wrapping nodes inside placeholder nodes.

Currently, the snippets are inserted into the syntax tree in `SourceChange::commit` so that snippet bits won't interfere with syntax lookups before completing a `SourceChange`.

It would be preferable if snippet rendering was deferred to after so that rendering can work directly with text ranges, but have left that for a future PR (it would also make it easier to finely specify which text edits have snippets in them).

Another possible snippet variation to support would be a group of placeholders (i.e. placeholders with the same tabstop number) so that a generated item and its uses can be renamed right as it's generated, which is something that is technically supported by the current snippet hack in VSCode, though it's not clear if that's a thing that is officially supported.
2023-04-05 14:33:30 +00:00
..
generated Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
imports Simplify 2023-02-27 15:51:45 +01:00
syntax_helpers fix: insert whitespace between text and pound 2023-04-05 20:33:17 +09:00
test_data Switch crate graph to use an Arena instead of a hashmap 2023-04-05 10:32:02 +02:00
tests ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
active_parameter.rs Lower and handle trait aliases in HIR 2023-03-04 00:24:07 +09:00
apply_change.rs Set proc_macros input when creating the RootDatabase 2023-03-25 18:20:42 +01:00
assists.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
defs.rs Add signature help for record struct patterns 2023-03-14 21:55:03 +01:00
famous_defs.rs Improve "Generate Deref impl" assist 2022-05-16 20:10:46 +02:00
helpers.rs feat: allow generate_function to generate in different local crate 2023-03-03 18:40:13 +09:00
items_locator.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
label.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
lib.rs Switch crate graph to use an Arena instead of a hashmap 2023-04-05 10:32:02 +02:00
line_index.rs Update crates/ide-db/src/line_index.rs 2023-02-14 08:19:58 +00:00
path_transform.rs ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
rename.rs fix: Fix renames of locals being broken in macro calls 2023-03-25 18:37:18 +01:00
rust_doc.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
search.rs fix: Fix search not searching bodies of attributed items 2023-03-09 15:30:17 +01:00
source_change.rs factor out adding a snippet 2023-03-26 18:08:10 -04:00
symbol_index.rs ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
traits.rs Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
ty_filter.rs Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
use_trivial_constructor.rs Fix typo 2023-03-03 01:12:39 +09:00