aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release.yaml76
-rw-r--r--Cargo.lock217
-rw-r--r--crates/assists/Cargo.toml2
-rw-r--r--crates/assists/src/assist_config.rs32
-rw-r--r--crates/assists/src/assist_context.rs10
-rw-r--r--crates/assists/src/ast_transform.rs3
-rw-r--r--crates/assists/src/handlers/add_explicit_type.rs32
-rw-r--r--crates/assists/src/handlers/add_missing_impl_members.rs56
-rw-r--r--crates/assists/src/handlers/add_turbo_fish.rs12
-rw-r--r--crates/assists/src/handlers/apply_demorgan.rs12
-rw-r--r--crates/assists/src/handlers/auto_import.rs64
-rw-r--r--crates/assists/src/handlers/change_visibility.rs42
-rw-r--r--crates/assists/src/handlers/convert_integer_literal.rs32
-rw-r--r--crates/assists/src/handlers/early_return.rs32
-rw-r--r--crates/assists/src/handlers/expand_glob_import.rs34
-rw-r--r--crates/assists/src/handlers/extract_struct_from_enum_variant.rs103
-rw-r--r--crates/assists/src/handlers/extract_variable.rs52
-rw-r--r--crates/assists/src/handlers/fill_match_arms.rs46
-rw-r--r--crates/assists/src/handlers/fix_visibility.rs104
-rw-r--r--crates/assists/src/handlers/flip_binexpr.rs24
-rw-r--r--crates/assists/src/handlers/flip_comma.rs12
-rw-r--r--crates/assists/src/handlers/flip_trait_bound.rs20
-rw-r--r--crates/assists/src/handlers/generate_default_from_enum_variant.rs10
-rw-r--r--crates/assists/src/handlers/generate_derive.rs12
-rw-r--r--crates/assists/src/handlers/generate_from_impl_for_enum.rs16
-rw-r--r--crates/assists/src/handlers/generate_function.rs63
-rw-r--r--crates/assists/src/handlers/generate_impl.rs14
-rw-r--r--crates/assists/src/handlers/generate_new.rs32
-rw-r--r--crates/assists/src/handlers/infer_function_return_type.rs36
-rw-r--r--crates/assists/src/handlers/inline_function.rs202
-rw-r--r--crates/assists/src/handlers/inline_local_variable.rs155
-rw-r--r--crates/assists/src/handlers/introduce_named_lifetime.rs42
-rw-r--r--crates/assists/src/handlers/invert_if.rs20
-rw-r--r--crates/assists/src/handlers/merge_imports.rs42
-rw-r--r--crates/assists/src/handlers/merge_match_arms.rs12
-rw-r--r--crates/assists/src/handlers/move_bounds.rs10
-rw-r--r--crates/assists/src/handlers/move_guard.rs26
-rw-r--r--crates/assists/src/handlers/move_module_to_file.rs (renamed from crates/assists/src/handlers/extract_module_to_file.rs)50
-rw-r--r--crates/assists/src/handlers/pull_assignment_up.rs400
-rw-r--r--crates/assists/src/handlers/qualify_path.rs76
-rw-r--r--crates/assists/src/handlers/raw_string.rs54
-rw-r--r--crates/assists/src/handlers/remove_dbg.rs80
-rw-r--r--crates/assists/src/handlers/remove_mut.rs2
-rw-r--r--crates/assists/src/handlers/remove_unused_param.rs61
-rw-r--r--crates/assists/src/handlers/reorder_fields.rs12
-rw-r--r--crates/assists/src/handlers/reorder_impl.rs201
-rw-r--r--crates/assists/src/handlers/replace_derive_with_manual_impl.rs20
-rw-r--r--crates/assists/src/handlers/replace_if_let_with_match.rs32
-rw-r--r--crates/assists/src/handlers/replace_impl_trait_with_generic.rs18
-rw-r--r--crates/assists/src/handlers/replace_let_with_if_let.rs4
-rw-r--r--crates/assists/src/handlers/replace_qualified_name_with_use.rs58
-rw-r--r--crates/assists/src/handlers/replace_string_with_char.rs14
-rw-r--r--crates/assists/src/handlers/replace_unwrap_with_match.rs10
-rw-r--r--crates/assists/src/handlers/split_import.rs12
-rw-r--r--crates/assists/src/handlers/toggle_ignore.rs6
-rw-r--r--crates/assists/src/handlers/unwrap_block.rs34
-rw-r--r--crates/assists/src/handlers/wrap_return_type_in_result.rs78
-rw-r--r--crates/assists/src/lib.rs16
-rw-r--r--crates/assists/src/tests.rs44
-rw-r--r--crates/assists/src/tests/generated.rs223
-rw-r--r--crates/assists/src/utils.rs23
-rw-r--r--crates/base_db/src/fixture.rs16
-rw-r--r--crates/base_db/src/input.rs7
-rw-r--r--crates/cfg/Cargo.toml2
-rw-r--r--crates/completion/Cargo.toml4
-rw-r--r--crates/completion/src/completions.rs5
-rw-r--r--crates/completion/src/completions/attribute.rs73
-rw-r--r--crates/completion/src/completions/dot.rs48
-rw-r--r--crates/completion/src/completions/fn_param.rs8
-rw-r--r--crates/completion/src/completions/keyword.rs56
-rw-r--r--crates/completion/src/completions/macro_in_item_position.rs2
-rw-r--r--crates/completion/src/completions/mod_.rs87
-rw-r--r--crates/completion/src/completions/pattern.rs20
-rw-r--r--crates/completion/src/completions/postfix.rs79
-rw-r--r--crates/completion/src/completions/postfix/format_like.rs7
-rw-r--r--crates/completion/src/completions/qualified_path.rs70
-rw-r--r--crates/completion/src/completions/record.rs94
-rw-r--r--crates/completion/src/completions/snippet.rs14
-rw-r--r--crates/completion/src/completions/trait_impl.rs123
-rw-r--r--crates/completion/src/completions/unqualified_path.rs109
-rw-r--r--crates/completion/src/config.rs48
-rw-r--r--crates/completion/src/context.rs10
-rw-r--r--crates/completion/src/item.rs6
-rw-r--r--crates/completion/src/lib.rs23
-rw-r--r--crates/completion/src/patterns.rs56
-rw-r--r--crates/completion/src/render.rs61
-rw-r--r--crates/completion/src/render/const_.rs8
-rw-r--r--crates/completion/src/render/enum_variant.rs2
-rw-r--r--crates/completion/src/render/function.rs36
-rw-r--r--crates/completion/src/render/macro_.rs23
-rw-r--r--crates/completion/src/render/pattern.rs6
-rw-r--r--crates/completion/src/render/type_alias.rs8
-rw-r--r--crates/completion/src/test_utils.rs26
-rw-r--r--crates/flycheck/Cargo.toml3
-rw-r--r--crates/flycheck/src/lib.rs23
-rw-r--r--crates/hir/Cargo.toml2
-rw-r--r--crates/hir/src/attrs.rs28
-rw-r--r--crates/hir/src/code_model.rs138
-rw-r--r--crates/hir/src/db.rs4
-rw-r--r--crates/hir/src/diagnostics.rs2
-rw-r--r--crates/hir/src/from_id.rs31
-rw-r--r--crates/hir/src/has_source.rs77
-rw-r--r--crates/hir/src/lib.rs7
-rw-r--r--crates/hir/src/semantics.rs12
-rw-r--r--crates/hir/src/semantics/source_to_def.rs18
-rw-r--r--crates/hir/src/source_analyzer.rs1
-rw-r--r--crates/hir_def/Cargo.toml4
-rw-r--r--crates/hir_def/src/attr.rs90
-rw-r--r--crates/hir_def/src/body/lower.rs6
-rw-r--r--crates/hir_def/src/body/scope.rs30
-rw-r--r--crates/hir_def/src/db.rs11
-rw-r--r--crates/hir_def/src/diagnostics.rs4
-rw-r--r--crates/hir_def/src/expr.rs2
-rw-r--r--crates/hir_def/src/find_path.rs48
-rw-r--r--crates/hir_def/src/generics.rs44
-rw-r--r--crates/hir_def/src/import_map.rs285
-rw-r--r--crates/hir_def/src/item_scope.rs3
-rw-r--r--crates/hir_def/src/item_tree.rs9
-rw-r--r--crates/hir_def/src/keys.rs5
-rw-r--r--crates/hir_def/src/lib.rs29
-rw-r--r--crates/hir_def/src/nameres.rs2
-rw-r--r--crates/hir_def/src/nameres/collector.rs41
-rw-r--r--crates/hir_def/src/nameres/tests/incremental.rs4
-rw-r--r--crates/hir_def/src/path.rs1
-rw-r--r--crates/hir_def/src/path/lower.rs2
-rw-r--r--crates/hir_def/src/resolver.rs19
-rw-r--r--crates/hir_expand/src/builtin_derive.rs2
-rw-r--r--crates/hir_expand/src/builtin_macro.rs3
-rw-r--r--crates/hir_expand/src/db.rs16
-rw-r--r--crates/hir_expand/src/eager.rs6
-rw-r--r--crates/hir_expand/src/hygiene.rs210
-rw-r--r--crates/hir_expand/src/name.rs2
-rw-r--r--crates/hir_expand/src/proc_macro.rs10
-rw-r--r--crates/hir_ty/Cargo.toml10
-rw-r--r--crates/hir_ty/src/db.rs7
-rw-r--r--crates/hir_ty/src/diagnostics.rs15
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs57
-rw-r--r--crates/hir_ty/src/diagnostics/match_check.rs4
-rw-r--r--crates/hir_ty/src/display.rs104
-rw-r--r--crates/hir_ty/src/infer/expr.rs2
-rw-r--r--crates/hir_ty/src/infer/path.rs1
-rw-r--r--crates/hir_ty/src/lib.rs4
-rw-r--r--crates/hir_ty/src/lower.rs21
-rw-r--r--crates/hir_ty/src/tests.rs2
-rw-r--r--crates/hir_ty/src/tests/display_source_code.rs15
-rw-r--r--crates/hir_ty/src/tests/macros.rs77
-rw-r--r--crates/hir_ty/src/tests/regression.rs18
-rw-r--r--crates/hir_ty/src/tests/simple.rs16
-rw-r--r--crates/hir_ty/src/tests/traits.rs8
-rw-r--r--crates/ide/Cargo.toml4
-rw-r--r--crates/ide/src/call_hierarchy.rs77
-rw-r--r--crates/ide/src/diagnostics.rs97
-rw-r--r--crates/ide/src/diagnostics/field_shorthand.rs8
-rw-r--r--crates/ide/src/diagnostics/fixes.rs16
-rw-r--r--crates/ide/src/display/navigation_target.rs145
-rw-r--r--crates/ide/src/display/short_label.rs11
-rw-r--r--crates/ide/src/doc_links.rs49
-rw-r--r--crates/ide/src/expand_macro.rs12
-rw-r--r--crates/ide/src/extend_selection.rs108
-rw-r--r--crates/ide/src/fixture.rs12
-rw-r--r--crates/ide/src/fn_references.rs6
-rw-r--r--crates/ide/src/goto_definition.rs237
-rw-r--r--crates/ide/src/goto_implementation.rs22
-rw-r--r--crates/ide/src/goto_type_definition.rs16
-rw-r--r--crates/ide/src/hover.rs576
-rw-r--r--crates/ide/src/inlay_hints.rs83
-rw-r--r--crates/ide/src/join_lines.rs136
-rw-r--r--crates/ide/src/lib.rs21
-rw-r--r--crates/ide/src/matching_brace.rs10
-rw-r--r--crates/ide/src/parent_module.rs8
-rw-r--r--crates/ide/src/references.rs181
-rw-r--r--crates/ide/src/references/rename.rs433
-rw-r--r--crates/ide/src/runnables.rs153
-rw-r--r--crates/ide/src/syntax_highlighting.rs820
-rw-r--r--crates/ide/src/syntax_highlighting/format.rs94
-rw-r--r--crates/ide/src/syntax_highlighting/highlight.rs530
-rw-r--r--crates/ide/src/syntax_highlighting/highlights.rs92
-rw-r--r--crates/ide/src/syntax_highlighting/html.rs28
-rw-r--r--crates/ide/src/syntax_highlighting/inject.rs158
-rw-r--r--crates/ide/src/syntax_highlighting/injection.rs183
-rw-r--r--crates/ide/src/syntax_highlighting/injector.rs78
-rw-r--r--crates/ide/src/syntax_highlighting/macro_rules.rs10
-rw-r--r--crates/ide/src/syntax_highlighting/tags.rs174
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html28
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html71
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html4
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlight_injection.html20
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlight_strings.html106
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html88
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlighting.html260
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/injection.html48
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html20
-rw-r--r--crates/ide/src/syntax_highlighting/tests.rs28
-rw-r--r--crates/ide/src/syntax_tree.rs20
-rw-r--r--crates/ide/src/typing.rs30
-rw-r--r--crates/ide/src/typing/on_enter.rs18
-rw-r--r--crates/ide/src/view_hir.rs25
-rw-r--r--crates/ide_db/Cargo.toml4
-rw-r--r--crates/ide_db/src/apply_change.rs1
-rw-r--r--crates/ide_db/src/call_info/tests.rs54
-rw-r--r--crates/ide_db/src/defs.rs35
-rw-r--r--crates/ide_db/src/helpers.rs109
-rw-r--r--crates/ide_db/src/helpers/famous_defs_fixture.rs120
-rw-r--r--crates/ide_db/src/imports_locator.rs23
-rw-r--r--crates/ide_db/src/search.rs164
-rw-r--r--crates/ide_db/src/traits/tests.rs18
-rw-r--r--crates/mbe/src/lib.rs16
-rw-r--r--crates/mbe/src/mbe_expander/matcher.rs10
-rw-r--r--crates/mbe/src/mbe_expander/transcriber.rs35
-rw-r--r--crates/mbe/src/parser.rs15
-rw-r--r--crates/mbe/src/subtree_source.rs152
-rw-r--r--crates/mbe/src/syntax_bridge.rs63
-rw-r--r--crates/mbe/src/tests.rs15
-rw-r--r--crates/parser/src/grammar.rs4
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs12
-rw-r--r--crates/parser/src/grammar/items.rs26
-rw-r--r--crates/parser/src/grammar/items/traits.rs2
-rw-r--r--crates/parser/src/grammar/items/use_item.rs2
-rw-r--r--crates/parser/src/grammar/patterns.rs2
-rw-r--r--crates/parser/src/grammar/type_args.rs6
-rw-r--r--crates/parser/src/grammar/type_params.rs4
-rw-r--r--crates/parser/src/lib.rs2
-rw-r--r--crates/proc_macro_api/src/msg.rs10
-rw-r--r--crates/proc_macro_api/src/process.rs7
-rw-r--r--crates/proc_macro_srv/Cargo.toml3
-rw-r--r--crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs2
-rw-r--r--crates/proc_macro_srv/src/rustc_server.rs45
-rw-r--r--crates/profile/src/stop_watch.rs6
-rw-r--r--crates/project_model/Cargo.toml4
-rw-r--r--crates/project_model/src/cargo_workspace.rs71
-rw-r--r--crates/project_model/src/lib.rs7
-rw-r--r--crates/project_model/src/project_json.rs13
-rw-r--r--crates/project_model/src/workspace.rs22
-rw-r--r--crates/rust-analyzer/Cargo.toml5
-rw-r--r--crates/rust-analyzer/src/bin/main.rs13
-rw-r--r--crates/rust-analyzer/src/caps.rs70
-rw-r--r--crates/rust-analyzer/src/cargo_target_spec.rs5
-rw-r--r--crates/rust-analyzer/src/cli/analysis_bench.rs18
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs50
-rw-r--r--crates/rust-analyzer/src/cli/load_cargo.rs1
-rw-r--r--crates/rust-analyzer/src/config.rs705
-rw-r--r--crates/rust-analyzer/src/diff.rs53
-rw-r--r--crates/rust-analyzer/src/global_state.rs13
-rw-r--r--crates/rust-analyzer/src/handlers.rs247
-rw-r--r--crates/rust-analyzer/src/lib.rs2
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs8
-rw-r--r--crates/rust-analyzer/src/lsp_utils.rs12
-rw-r--r--crates/rust-analyzer/src/main_loop.rs106
-rw-r--r--crates/rust-analyzer/src/markdown.rs15
-rw-r--r--crates/rust-analyzer/src/op_queue.rs25
-rw-r--r--crates/rust-analyzer/src/reload.rs127
-rw-r--r--crates/rust-analyzer/src/semantic_tokens.rs9
-rw-r--r--crates/rust-analyzer/src/to_proto.rs111
-rw-r--r--crates/rust-analyzer/tests/rust-analyzer/main.rs209
-rw-r--r--crates/rust-analyzer/tests/rust-analyzer/support.rs64
-rw-r--r--crates/ssr/Cargo.toml4
-rw-r--r--crates/ssr/src/matching.rs4
-rw-r--r--crates/ssr/src/parsing.rs15
-rw-r--r--crates/ssr/src/search.rs20
-rw-r--r--crates/ssr/src/tests.rs113
-rw-r--r--crates/stdx/src/lib.rs39
-rw-r--r--crates/syntax/Cargo.toml6
-rw-r--r--crates/syntax/src/algo.rs6
-rw-r--r--crates/syntax/src/ast/edit.rs4
-rw-r--r--crates/syntax/src/ast/generated/nodes.rs2
-rw-r--r--crates/syntax/src/ast/make.rs2
-rw-r--r--crates/syntax/src/ast/node_ext.rs2
-rw-r--r--crates/syntax/src/lib.rs9
-rw-r--r--crates/syntax/src/parsing/lexer.rs8
-rw-r--r--crates/syntax/src/parsing/reparsing.rs56
-rw-r--r--crates/syntax/src/tests.rs9
-rw-r--r--crates/syntax/src/validation.rs6
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_attr.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_attr.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_multiple_stmts.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_multiple_stmts.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_open_parenthesis.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_open_parenthesis.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_semicolon.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_semicolon.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_unterminated_expr.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/err/0000_unterminated_expr.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_expr.rast9
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_expr.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_expr_block.rast69
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_expr_block.rs5
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_fn_call.rast11
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_fn_call.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_let_stmt.rast12
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_let_stmt.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_macro_let_stmt.rast21
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_macro_let_stmt.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_macro_unterminated_let_stmt.rast21
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_macro_unterminated_let_stmt.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_struct_item.rast22
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_struct_item.rs3
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_unterminated_fn_call.rast10
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_unterminated_fn_call.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_unterminated_let_stmt.rast11
-rw-r--r--crates/syntax/test_data/parser/fragments/stmt/ok/0000_unterminated_let_stmt.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast98
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast28
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs2
-rw-r--r--crates/test_utils/Cargo.toml2
-rw-r--r--crates/test_utils/src/lib.rs36
-rw-r--r--crates/tt/src/buffer.rs105
-rw-r--r--crates/vfs/src/lib.rs51
-rw-r--r--docs/dev/README.md4
-rw-r--r--docs/dev/lsp-extensions.md13
-rw-r--r--docs/dev/style.md211
-rw-r--r--docs/user/generated_config.adoc108
-rw-r--r--docs/user/manual.adoc9
-rw-r--r--editors/code/package.json29
-rw-r--r--editors/code/src/client.ts11
-rw-r--r--editors/code/src/commands.ts55
-rw-r--r--editors/code/src/config.ts7
-rw-r--r--editors/code/src/ctx.ts2
-rw-r--r--editors/code/src/lsp_ext.ts1
-rw-r--r--editors/code/src/main.ts27
-rw-r--r--xtask/Cargo.toml2
-rw-r--r--xtask/src/codegen/gen_assists_docs.rs4
-rw-r--r--xtask/src/dist.rs10
-rw-r--r--xtask/src/main.rs12
-rw-r--r--xtask/tests/tidy.rs54
325 files changed, 9669 insertions, 6005 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 7b9fbe6b8..ece1fd364 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -15,8 +15,8 @@ env:
15 RUSTUP_MAX_RETRIES: 10 15 RUSTUP_MAX_RETRIES: 10
16 16
17jobs: 17jobs:
18 dist-windows: 18 dist-x86_64-pc-windows-msvc:
19 name: dist (Windows) 19 name: dist (x86_64-pc-windows-msvc)
20 runs-on: windows-latest 20 runs-on: windows-latest
21 env: 21 env:
22 RA_TARGET: x86_64-pc-windows-msvc 22 RA_TARGET: x86_64-pc-windows-msvc
@@ -45,11 +45,41 @@ jobs:
45 - name: Upload artifacts 45 - name: Upload artifacts
46 uses: actions/upload-artifact@v1 46 uses: actions/upload-artifact@v1
47 with: 47 with:
48 name: dist-windows-latest 48 name: dist-x86_64-pc-windows-msvc
49 path: ./dist 49 path: ./dist
50 50
51 dist-ubuntu: 51 dist-aarch64-pc-windows-msvc:
52 name: dist (Ubuntu 16.04) 52 name: dist (aarch64-pc-windows-msvc)
53 runs-on: windows-latest
54 env:
55 RA_TARGET: aarch64-pc-windows-msvc
56
57 steps:
58 - name: Checkout repository
59 uses: actions/checkout@v2
60
61 - name: Rename existing rust toolchain
62 run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
63
64 - name: Install Rust toolchain
65 uses: actions-rs/toolchain@v1
66 with:
67 toolchain: stable
68 target: aarch64-pc-windows-msvc
69 profile: minimal
70 override: true
71
72 - name: Dist
73 run: cargo xtask dist
74
75 - name: Upload artifacts
76 uses: actions/upload-artifact@v1
77 with:
78 name: dist-aarch64-pc-windows-msvc
79 path: ./dist
80
81 dist-x86_64-unknown-linux-gnu:
82 name: dist (x86_64-unknown-linux-gnu)
53 runs-on: ubuntu-16.04 83 runs-on: ubuntu-16.04
54 env: 84 env:
55 RA_TARGET: x86_64-unknown-linux-gnu 85 RA_TARGET: x86_64-unknown-linux-gnu
@@ -85,11 +115,11 @@ jobs:
85 - name: Upload artifacts 115 - name: Upload artifacts
86 uses: actions/upload-artifact@v1 116 uses: actions/upload-artifact@v1
87 with: 117 with:
88 name: dist-ubuntu-16.04 118 name: dist-x86_64-unknown-linux-gnu
89 path: ./dist 119 path: ./dist
90 120
91 dist-macos-latest: 121 dist-x86_64-apple-darwin:
92 name: dist (MacOS latest) 122 name: dist (x86_64-apple-darwin)
93 runs-on: macos-latest 123 runs-on: macos-latest
94 env: 124 env:
95 RA_TARGET: x86_64-apple-darwin 125 RA_TARGET: x86_64-apple-darwin
@@ -111,12 +141,12 @@ jobs:
111 - name: Upload artifacts 141 - name: Upload artifacts
112 uses: actions/upload-artifact@v1 142 uses: actions/upload-artifact@v1
113 with: 143 with:
114 name: dist-macos-latest 144 name: dist-x86_64-apple-darwin
115 path: ./dist 145 path: ./dist
116 146
117 dist-macos-11: 147 dist-aarch64-apple-darwin:
118 name: dist (MacOS 11.0) 148 name: dist (aarch64-apple-darwin)
119 runs-on: macos-11.0 149 runs-on: macos-latest
120 env: 150 env:
121 RA_TARGET: aarch64-apple-darwin 151 RA_TARGET: aarch64-apple-darwin
122 152
@@ -124,27 +154,27 @@ jobs:
124 - name: Checkout repository 154 - name: Checkout repository
125 uses: actions/checkout@v2 155 uses: actions/checkout@v2
126 156
127 - name: Install Rust toolchain (beta) 157 - name: Install Rust toolchain
128 uses: actions-rs/toolchain@v1 158 uses: actions-rs/toolchain@v1
129 with: 159 with:
130 toolchain: beta 160 toolchain: stable
131 target: aarch64-apple-darwin 161 target: aarch64-apple-darwin
132 profile: minimal 162 profile: minimal
133 override: true 163 override: true
134 164
135 - name: Dist 165 - name: Dist
136 run: cargo xtask dist 166 run: SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo xtask dist
137 167
138 - name: Upload artifacts 168 - name: Upload artifacts
139 uses: actions/upload-artifact@v1 169 uses: actions/upload-artifact@v1
140 with: 170 with:
141 name: dist-macos-11.0 171 name: dist-aarch64-apple-darwin
142 path: ./dist 172 path: ./dist
143 173
144 publish: 174 publish:
145 name: publish 175 name: publish
146 runs-on: ubuntu-16.04 176 runs-on: ubuntu-16.04
147 needs: ['dist-windows', 'dist-ubuntu', 'dist-macos-latest', 'dist-macos-11'] 177 needs: ['dist-x86_64-pc-windows-msvc', 'dist-aarch64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-x86_64-apple-darwin', 'dist-aarch64-apple-darwin']
148 steps: 178 steps:
149 - name: Install Nodejs 179 - name: Install Nodejs
150 uses: actions/setup-node@v1 180 uses: actions/setup-node@v1
@@ -165,19 +195,23 @@ jobs:
165 195
166 - uses: actions/download-artifact@v1 196 - uses: actions/download-artifact@v1
167 with: 197 with:
168 name: dist-macos-11.0 198 name: dist-aarch64-apple-darwin
199 path: dist
200 - uses: actions/download-artifact@v1
201 with:
202 name: dist-x86_64-apple-darwin
169 path: dist 203 path: dist
170 - uses: actions/download-artifact@v1 204 - uses: actions/download-artifact@v1
171 with: 205 with:
172 name: dist-macos-latest 206 name: dist-x86_64-unknown-linux-gnu
173 path: dist 207 path: dist
174 - uses: actions/download-artifact@v1 208 - uses: actions/download-artifact@v1
175 with: 209 with:
176 name: dist-ubuntu-16.04 210 name: dist-x86_64-pc-windows-msvc
177 path: dist 211 path: dist
178 - uses: actions/download-artifact@v1 212 - uses: actions/download-artifact@v1
179 with: 213 with:
180 name: dist-windows-latest 214 name: dist-aarch64-pc-windows-msvc
181 path: dist 215 path: dist
182 - run: ls -al ./dist 216 - run: ls -al ./dist
183 217
diff --git a/Cargo.lock b/Cargo.lock
index fd04ec3c5..7b175ec67 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,9 +2,9 @@
2# It is not intended for manual editing. 2# It is not intended for manual editing.
3[[package]] 3[[package]]
4name = "addr2line" 4name = "addr2line"
5version = "0.14.0" 5version = "0.14.1"
6source = "registry+https://github.com/rust-lang/crates.io-index" 6source = "registry+https://github.com/rust-lang/crates.io-index"
7checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" 7checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7"
8dependencies = [ 8dependencies = [
9 "gimli", 9 "gimli",
10] 10]
@@ -26,9 +26,9 @@ dependencies = [
26 26
27[[package]] 27[[package]]
28name = "anyhow" 28name = "anyhow"
29version = "1.0.36" 29version = "1.0.38"
30source = "registry+https://github.com/rust-lang/crates.io-index" 30source = "registry+https://github.com/rust-lang/crates.io-index"
31checksum = "68803225a7b13e47191bab76f2687382b60d259e8cf37f6e1893658b84bb9479" 31checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
32 32
33[[package]] 33[[package]]
34name = "anymap" 34name = "anymap"
@@ -53,7 +53,7 @@ dependencies = [
53 "either", 53 "either",
54 "hir", 54 "hir",
55 "ide_db", 55 "ide_db",
56 "itertools", 56 "itertools 0.10.0",
57 "profile", 57 "profile",
58 "rustc-hash", 58 "rustc-hash",
59 "stdx", 59 "stdx",
@@ -122,17 +122,28 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
122 122
123[[package]] 123[[package]]
124name = "byteorder" 124name = "byteorder"
125version = "1.3.4" 125version = "1.4.2"
126source = "registry+https://github.com/rust-lang/crates.io-index"
127checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
128
129[[package]]
130name = "cargo-platform"
131version = "0.1.1"
126source = "registry+https://github.com/rust-lang/crates.io-index" 132source = "registry+https://github.com/rust-lang/crates.io-index"
127checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" 133checksum = "0226944a63d1bf35a3b5f948dd7c59e263db83695c9e8bffc4037de02e30f1d7"
134dependencies = [
135 "serde",
136]
128 137
129[[package]] 138[[package]]
130name = "cargo_metadata" 139name = "cargo_metadata"
131version = "0.12.0" 140version = "0.12.2"
132source = "registry+https://github.com/rust-lang/crates.io-index" 141source = "registry+https://github.com/rust-lang/crates.io-index"
133checksum = "d5a5f7b42f606b7f23674f6f4d877628350682bc40687d3fae65679a58d55345" 142checksum = "11a47b6286279a9998588ef7050d1ebc2500c69892a557c90fe5d071c64415dc"
134dependencies = [ 143dependencies = [
135 "semver 0.11.0", 144 "cargo-platform",
145 "semver",
146 "semver-parser",
136 "serde", 147 "serde",
137 "serde_json", 148 "serde_json",
138] 149]
@@ -168,9 +179,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
168 179
169[[package]] 180[[package]]
170name = "chalk-derive" 181name = "chalk-derive"
171version = "0.45.0" 182version = "0.47.0"
172source = "registry+https://github.com/rust-lang/crates.io-index" 183source = "registry+https://github.com/rust-lang/crates.io-index"
173checksum = "ec7dacf94958d1a930b95d049d9443860859af59eadc77849392093eb577bcee" 184checksum = "3f00f6342a387edc822002d36a381e117afcac9f744951ff75fbf4a218edea5c"
174dependencies = [ 185dependencies = [
175 "proc-macro2", 186 "proc-macro2",
176 "quote", 187 "quote",
@@ -180,9 +191,9 @@ dependencies = [
180 191
181[[package]] 192[[package]]
182name = "chalk-ir" 193name = "chalk-ir"
183version = "0.45.0" 194version = "0.47.0"
184source = "registry+https://github.com/rust-lang/crates.io-index" 195source = "registry+https://github.com/rust-lang/crates.io-index"
185checksum = "a1a5b38ede247def17da87f4badb62396a5753db6048e2011d3089d8b3796c67" 196checksum = "c686e69913591ae753e5526e73cbee39db3d9b0a92cc9078ab780cabf1c70aa9"
186dependencies = [ 197dependencies = [
187 "bitflags", 198 "bitflags",
188 "chalk-derive", 199 "chalk-derive",
@@ -191,9 +202,9 @@ dependencies = [
191 202
192[[package]] 203[[package]]
193name = "chalk-recursive" 204name = "chalk-recursive"
194version = "0.45.0" 205version = "0.47.0"
195source = "registry+https://github.com/rust-lang/crates.io-index" 206source = "registry+https://github.com/rust-lang/crates.io-index"
196checksum = "7a18db146d7a023edc20ad094e8c2284451f7888719645004979617d1f17c041" 207checksum = "310fdcac0340dab4163b766baa8067266e3b909108d1ac1b5246c033bde63975"
197dependencies = [ 208dependencies = [
198 "chalk-derive", 209 "chalk-derive",
199 "chalk-ir", 210 "chalk-ir",
@@ -204,14 +215,14 @@ dependencies = [
204 215
205[[package]] 216[[package]]
206name = "chalk-solve" 217name = "chalk-solve"
207version = "0.45.0" 218version = "0.47.0"
208source = "registry+https://github.com/rust-lang/crates.io-index" 219source = "registry+https://github.com/rust-lang/crates.io-index"
209checksum = "7f73e0de04a0f394e47ed8118e00541bcf681d7c3c2ef500fa743eb4cf3a4850" 220checksum = "c3c3252116111c3548f1164ab8d98c67c49848b3bde10dd11b650fd023e91c72"
210dependencies = [ 221dependencies = [
211 "chalk-derive", 222 "chalk-derive",
212 "chalk-ir", 223 "chalk-ir",
213 "ena", 224 "ena",
214 "itertools", 225 "itertools 0.9.0",
215 "petgraph", 226 "petgraph",
216 "rustc-hash", 227 "rustc-hash",
217 "tracing", 228 "tracing",
@@ -250,7 +261,7 @@ dependencies = [
250 "expect-test", 261 "expect-test",
251 "hir", 262 "hir",
252 "ide_db", 263 "ide_db",
253 "itertools", 264 "itertools 0.10.0",
254 "log", 265 "log",
255 "profile", 266 "profile",
256 "rustc-hash", 267 "rustc-hash",
@@ -262,9 +273,9 @@ dependencies = [
262 273
263[[package]] 274[[package]]
264name = "const_fn" 275name = "const_fn"
265version = "0.4.4" 276version = "0.4.5"
266source = "registry+https://github.com/rust-lang/crates.io-index" 277source = "registry+https://github.com/rust-lang/crates.io-index"
267checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826" 278checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6"
268 279
269[[package]] 280[[package]]
270name = "crc32fast" 281name = "crc32fast"
@@ -343,10 +354,10 @@ dependencies = [
343] 354]
344 355
345[[package]] 356[[package]]
346name = "difference" 357name = "dissimilar"
347version = "2.0.0" 358version = "1.0.2"
348source = "registry+https://github.com/rust-lang/crates.io-index" 359source = "registry+https://github.com/rust-lang/crates.io-index"
349checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" 360checksum = "fc4b29f4b9bb94bf267d57269fd0706d343a160937108e9619fe380645428abb"
350 361
351[[package]] 362[[package]]
352name = "drop_bomb" 363name = "drop_bomb"
@@ -380,11 +391,11 @@ dependencies = [
380 391
381[[package]] 392[[package]]
382name = "expect-test" 393name = "expect-test"
383version = "1.0.2" 394version = "1.1.0"
384source = "registry+https://github.com/rust-lang/crates.io-index" 395source = "registry+https://github.com/rust-lang/crates.io-index"
385checksum = "eab78d4c727fa879de40951ffc01ed781a231b28786b19d6bfbdc0d1ec92eb3e" 396checksum = "2300477aab3a378f2ca00a4fbd4dc713654ab7ed790e4017493cb33656280633"
386dependencies = [ 397dependencies = [
387 "difference", 398 "dissimilar",
388 "once_cell", 399 "once_cell",
389] 400]
390 401
@@ -427,6 +438,7 @@ dependencies = [
427 "jod-thread", 438 "jod-thread",
428 "log", 439 "log",
429 "serde_json", 440 "serde_json",
441 "stdx",
430 "toolchain", 442 "toolchain",
431] 443]
432 444
@@ -482,19 +494,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
482checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 494checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
483 495
484[[package]] 496[[package]]
485name = "generator"
486version = "0.6.23"
487source = "registry+https://github.com/rust-lang/crates.io-index"
488checksum = "8cdc09201b2e8ca1b19290cf7e65de2246b8e91fb6874279722189c4de7b94dc"
489dependencies = [
490 "cc",
491 "libc",
492 "log",
493 "rustc_version",
494 "winapi 0.3.9",
495]
496
497[[package]]
498name = "gimli" 497name = "gimli"
499version = "0.23.0" 498version = "0.23.0"
500source = "registry+https://github.com/rust-lang/crates.io-index" 499source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -534,7 +533,7 @@ dependencies = [
534 "hir_def", 533 "hir_def",
535 "hir_expand", 534 "hir_expand",
536 "hir_ty", 535 "hir_ty",
537 "itertools", 536 "itertools 0.10.0",
538 "log", 537 "log",
539 "profile", 538 "profile",
540 "rustc-hash", 539 "rustc-hash",
@@ -557,7 +556,7 @@ dependencies = [
557 "fst", 556 "fst",
558 "hir_expand", 557 "hir_expand",
559 "indexmap", 558 "indexmap",
560 "itertools", 559 "itertools 0.10.0",
561 "log", 560 "log",
562 "mbe", 561 "mbe",
563 "once_cell", 562 "once_cell",
@@ -601,7 +600,7 @@ dependencies = [
601 "expect-test", 600 "expect-test",
602 "hir_def", 601 "hir_def",
603 "hir_expand", 602 "hir_expand",
604 "itertools", 603 "itertools 0.10.0",
605 "log", 604 "log",
606 "once_cell", 605 "once_cell",
607 "profile", 606 "profile",
@@ -637,7 +636,7 @@ dependencies = [
637 "hir", 636 "hir",
638 "ide_db", 637 "ide_db",
639 "indexmap", 638 "indexmap",
640 "itertools", 639 "itertools 0.10.0",
641 "log", 640 "log",
642 "oorandom", 641 "oorandom",
643 "profile", 642 "profile",
@@ -661,7 +660,7 @@ dependencies = [
661 "expect-test", 660 "expect-test",
662 "fst", 661 "fst",
663 "hir", 662 "hir",
664 "itertools", 663 "itertools 0.10.0",
665 "log", 664 "log",
666 "once_cell", 665 "once_cell",
667 "profile", 666 "profile",
@@ -742,10 +741,19 @@ dependencies = [
742] 741]
743 742
744[[package]] 743[[package]]
744name = "itertools"
745version = "0.10.0"
746source = "registry+https://github.com/rust-lang/crates.io-index"
747checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319"
748dependencies = [
749 "either",
750]
751
752[[package]]
745name = "itoa" 753name = "itoa"
746version = "0.4.6" 754version = "0.4.7"
747source = "registry+https://github.com/rust-lang/crates.io-index" 755source = "registry+https://github.com/rust-lang/crates.io-index"
748checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" 756checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
749 757
750[[package]] 758[[package]]
751name = "jod-thread" 759name = "jod-thread"
@@ -777,9 +785,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
777 785
778[[package]] 786[[package]]
779name = "libc" 787name = "libc"
780version = "0.2.81" 788version = "0.2.82"
781source = "registry+https://github.com/rust-lang/crates.io-index" 789source = "registry+https://github.com/rust-lang/crates.io-index"
782checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" 790checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929"
783 791
784[[package]] 792[[package]]
785name = "libloading" 793name = "libloading"
@@ -811,24 +819,11 @@ dependencies = [
811 819
812[[package]] 820[[package]]
813name = "log" 821name = "log"
814version = "0.4.11" 822version = "0.4.13"
815source = "registry+https://github.com/rust-lang/crates.io-index"
816checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
817dependencies = [
818 "cfg-if 0.1.10",
819]
820
821[[package]]
822name = "loom"
823version = "0.3.6"
824source = "registry+https://github.com/rust-lang/crates.io-index" 823source = "registry+https://github.com/rust-lang/crates.io-index"
825checksum = "a0e8460f2f2121162705187214720353c517b97bdfb3494c0b1e33d83ebe4bed" 824checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2"
826dependencies = [ 825dependencies = [
827 "cfg-if 0.1.10", 826 "cfg-if 0.1.10",
828 "generator",
829 "scoped-tls",
830 "serde",
831 "serde_json",
832] 827]
833 828
834[[package]] 829[[package]]
@@ -1150,9 +1145,9 @@ checksum = "28b9b4df73455c861d7cbf8be42f01d3b373ed7f02e378d55fa84eafc6f638b1"
1150 1145
1151[[package]] 1146[[package]]
1152name = "pin-project-lite" 1147name = "pin-project-lite"
1153version = "0.2.0" 1148version = "0.2.4"
1154source = "registry+https://github.com/rust-lang/crates.io-index" 1149source = "registry+https://github.com/rust-lang/crates.io-index"
1155checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" 1150checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827"
1156 1151
1157[[package]] 1152[[package]]
1158name = "proc-macro2" 1153name = "proc-macro2"
@@ -1181,7 +1176,6 @@ name = "proc_macro_srv"
1181version = "0.0.0" 1176version = "0.0.0"
1182dependencies = [ 1177dependencies = [
1183 "cargo_metadata", 1178 "cargo_metadata",
1184 "difference",
1185 "libloading", 1179 "libloading",
1186 "mbe", 1180 "mbe",
1187 "memmap", 1181 "memmap",
@@ -1219,7 +1213,7 @@ dependencies = [
1219 "base_db", 1213 "base_db",
1220 "cargo_metadata", 1214 "cargo_metadata",
1221 "cfg", 1215 "cfg",
1222 "itertools", 1216 "itertools 0.10.0",
1223 "log", 1217 "log",
1224 "paths", 1218 "paths",
1225 "proc_macro_api", 1219 "proc_macro_api",
@@ -1292,9 +1286,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
1292 1286
1293[[package]] 1287[[package]]
1294name = "regex" 1288name = "regex"
1295version = "1.4.2" 1289version = "1.4.3"
1296source = "registry+https://github.com/rust-lang/crates.io-index" 1290source = "registry+https://github.com/rust-lang/crates.io-index"
1297checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" 1291checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
1298dependencies = [ 1292dependencies = [
1299 "regex-syntax", 1293 "regex-syntax",
1300] 1294]
@@ -1311,9 +1305,9 @@ dependencies = [
1311 1305
1312[[package]] 1306[[package]]
1313name = "regex-syntax" 1307name = "regex-syntax"
1314version = "0.6.21" 1308version = "0.6.22"
1315source = "registry+https://github.com/rust-lang/crates.io-index" 1309source = "registry+https://github.com/rust-lang/crates.io-index"
1316checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" 1310checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
1317 1311
1318[[package]] 1312[[package]]
1319name = "rowan" 1313name = "rowan"
@@ -1334,6 +1328,7 @@ dependencies = [
1334 "anyhow", 1328 "anyhow",
1335 "cfg", 1329 "cfg",
1336 "crossbeam-channel 0.5.0", 1330 "crossbeam-channel 0.5.0",
1331 "dissimilar",
1337 "env_logger", 1332 "env_logger",
1338 "expect-test", 1333 "expect-test",
1339 "flycheck", 1334 "flycheck",
@@ -1342,7 +1337,7 @@ dependencies = [
1342 "hir_ty", 1337 "hir_ty",
1343 "ide", 1338 "ide",
1344 "ide_db", 1339 "ide_db",
1345 "itertools", 1340 "itertools 0.10.0",
1346 "jod-thread", 1341 "jod-thread",
1347 "log", 1342 "log",
1348 "lsp-server", 1343 "lsp-server",
@@ -1378,9 +1373,9 @@ dependencies = [
1378 1373
1379[[package]] 1374[[package]]
1380name = "rustc-ap-rustc_lexer" 1375name = "rustc-ap-rustc_lexer"
1381version = "695.0.0" 1376version = "697.0.0"
1382source = "registry+https://github.com/rust-lang/crates.io-index" 1377source = "registry+https://github.com/rust-lang/crates.io-index"
1383checksum = "390bad134705b0bff02cd9541ac66df751a91c3cc734c3369cd6151ca269caed" 1378checksum = "67adbe260a0a11910624d6d28c0304fcf7b063e666682111005c83b09f73429d"
1384dependencies = [ 1379dependencies = [
1385 "unicode-xid", 1380 "unicode-xid",
1386] 1381]
@@ -1398,15 +1393,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1398checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 1393checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
1399 1394
1400[[package]] 1395[[package]]
1401name = "rustc_version"
1402version = "0.2.3"
1403source = "registry+https://github.com/rust-lang/crates.io-index"
1404checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
1405dependencies = [
1406 "semver 0.9.0",
1407]
1408
1409[[package]]
1410name = "ryu" 1396name = "ryu"
1411version = "1.0.5" 1397version = "1.0.5"
1412source = "registry+https://github.com/rust-lang/crates.io-index" 1398source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1464,34 +1450,19 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
1464 1450
1465[[package]] 1451[[package]]
1466name = "semver" 1452name = "semver"
1467version = "0.9.0"
1468source = "registry+https://github.com/rust-lang/crates.io-index"
1469checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
1470dependencies = [
1471 "semver-parser 0.7.0",
1472]
1473
1474[[package]]
1475name = "semver"
1476version = "0.11.0" 1453version = "0.11.0"
1477source = "registry+https://github.com/rust-lang/crates.io-index" 1454source = "registry+https://github.com/rust-lang/crates.io-index"
1478checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" 1455checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
1479dependencies = [ 1456dependencies = [
1480 "semver-parser 0.10.1", 1457 "semver-parser",
1481 "serde", 1458 "serde",
1482] 1459]
1483 1460
1484[[package]] 1461[[package]]
1485name = "semver-parser" 1462name = "semver-parser"
1486version = "0.7.0" 1463version = "0.10.2"
1487source = "registry+https://github.com/rust-lang/crates.io-index" 1464source = "registry+https://github.com/rust-lang/crates.io-index"
1488checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 1465checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
1489
1490[[package]]
1491name = "semver-parser"
1492version = "0.10.1"
1493source = "registry+https://github.com/rust-lang/crates.io-index"
1494checksum = "42ef146c2ad5e5f4b037cd6ce2ebb775401729b19a82040c1beac9d36c7d1428"
1495dependencies = [ 1466dependencies = [
1496 "pest", 1467 "pest",
1497] 1468]
@@ -1518,9 +1489,9 @@ dependencies = [
1518 1489
1519[[package]] 1490[[package]]
1520name = "serde_json" 1491name = "serde_json"
1521version = "1.0.60" 1492version = "1.0.61"
1522source = "registry+https://github.com/rust-lang/crates.io-index" 1493source = "registry+https://github.com/rust-lang/crates.io-index"
1523checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779" 1494checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a"
1524dependencies = [ 1495dependencies = [
1525 "indexmap", 1496 "indexmap",
1526 "itoa", 1497 "itoa",
@@ -1550,12 +1521,11 @@ dependencies = [
1550 1521
1551[[package]] 1522[[package]]
1552name = "sharded-slab" 1523name = "sharded-slab"
1553version = "0.1.0" 1524version = "0.1.1"
1554source = "registry+https://github.com/rust-lang/crates.io-index" 1525source = "registry+https://github.com/rust-lang/crates.io-index"
1555checksum = "7b4921be914e16899a80adefb821f8ddb7974e3f1250223575a44ed994882127" 1526checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3"
1556dependencies = [ 1527dependencies = [
1557 "lazy_static", 1528 "lazy_static",
1558 "loom",
1559] 1529]
1560 1530
1561[[package]] 1531[[package]]
@@ -1566,9 +1536,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
1566 1536
1567[[package]] 1537[[package]]
1568name = "smallvec" 1538name = "smallvec"
1569version = "1.5.1" 1539version = "1.6.1"
1570source = "registry+https://github.com/rust-lang/crates.io-index" 1540source = "registry+https://github.com/rust-lang/crates.io-index"
1571checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75" 1541checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
1572 1542
1573[[package]] 1543[[package]]
1574name = "smol_str" 1544name = "smol_str"
@@ -1586,7 +1556,7 @@ dependencies = [
1586 "expect-test", 1556 "expect-test",
1587 "hir", 1557 "hir",
1588 "ide_db", 1558 "ide_db",
1589 "itertools", 1559 "itertools 0.10.0",
1590 "rustc-hash", 1560 "rustc-hash",
1591 "syntax", 1561 "syntax",
1592 "test_utils", 1562 "test_utils",
@@ -1599,9 +1569,9 @@ version = "0.0.0"
1599 1569
1600[[package]] 1570[[package]]
1601name = "syn" 1571name = "syn"
1602version = "1.0.55" 1572version = "1.0.58"
1603source = "registry+https://github.com/rust-lang/crates.io-index" 1573source = "registry+https://github.com/rust-lang/crates.io-index"
1604checksum = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a" 1574checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5"
1605dependencies = [ 1575dependencies = [
1606 "proc-macro2", 1576 "proc-macro2",
1607 "quote", 1577 "quote",
@@ -1627,7 +1597,7 @@ dependencies = [
1627 "arrayvec", 1597 "arrayvec",
1628 "expect-test", 1598 "expect-test",
1629 "indexmap", 1599 "indexmap",
1630 "itertools", 1600 "itertools 0.10.0",
1631 "once_cell", 1601 "once_cell",
1632 "parser", 1602 "parser",
1633 "profile", 1603 "profile",
@@ -1656,7 +1626,7 @@ dependencies = [
1656name = "test_utils" 1626name = "test_utils"
1657version = "0.0.0" 1627version = "0.0.0"
1658dependencies = [ 1628dependencies = [
1659 "difference", 1629 "dissimilar",
1660 "rustc-hash", 1630 "rustc-hash",
1661 "serde_json", 1631 "serde_json",
1662 "stdx", 1632 "stdx",
@@ -1665,9 +1635,9 @@ dependencies = [
1665 1635
1666[[package]] 1636[[package]]
1667name = "text-size" 1637name = "text-size"
1668version = "1.0.0" 1638version = "1.1.0"
1669source = "registry+https://github.com/rust-lang/crates.io-index" 1639source = "registry+https://github.com/rust-lang/crates.io-index"
1670checksum = "f03e7efdedc3bc78cb2337f1e2785c39e45f5ef762d9e4ebb137fff7380a6d8a" 1640checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a"
1671 1641
1672[[package]] 1642[[package]]
1673name = "text_edit" 1643name = "text_edit"
@@ -1684,9 +1654,9 @@ checksum = "db3c46be180f1af9673ebb27bc1235396f61ef6965b3fe0dbb2e624deb604f0e"
1684 1654
1685[[package]] 1655[[package]]
1686name = "thread_local" 1656name = "thread_local"
1687version = "1.0.1" 1657version = "1.1.0"
1688source = "registry+https://github.com/rust-lang/crates.io-index" 1658source = "registry+https://github.com/rust-lang/crates.io-index"
1689checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" 1659checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447"
1690dependencies = [ 1660dependencies = [
1691 "lazy_static", 1661 "lazy_static",
1692] 1662]
@@ -1810,15 +1780,16 @@ dependencies = [
1810 1780
1811[[package]] 1781[[package]]
1812name = "tracing-tree" 1782name = "tracing-tree"
1813version = "0.1.6" 1783version = "0.1.7"
1814source = "registry+https://github.com/rust-lang/crates.io-index" 1784source = "registry+https://github.com/rust-lang/crates.io-index"
1815checksum = "43aac8afb493b08e1e1904956f7407c1e671b9c83b26a17e1bd83d6a3520e350" 1785checksum = "023e80cdb7c8468b7aade1d756afa2acbe2ae0a6142a25ec664b5239d6ef2794"
1816dependencies = [ 1786dependencies = [
1817 "ansi_term", 1787 "ansi_term",
1818 "atty", 1788 "atty",
1819 "chrono", 1789 "chrono",
1820 "termcolor", 1790 "termcolor",
1821 "tracing", 1791 "tracing",
1792 "tracing-log",
1822 "tracing-subscriber", 1793 "tracing-subscriber",
1823] 1794]
1824 1795
@@ -1838,9 +1809,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
1838 1809
1839[[package]] 1810[[package]]
1840name = "ungrammar" 1811name = "ungrammar"
1841version = "1.5.0" 1812version = "1.6.0"
1842source = "registry+https://github.com/rust-lang/crates.io-index" 1813source = "registry+https://github.com/rust-lang/crates.io-index"
1843checksum = "c11bffada52edc8f2a56160b286ea4640acf90ffcb21bded361ccb8ed43a1457" 1814checksum = "f96cc1b6938f7c548fbcc630bac5c896ae77a130909829ab18b8eab78c51b7ee"
1844 1815
1845[[package]] 1816[[package]]
1846name = "unicase" 1817name = "unicase"
diff --git a/crates/assists/Cargo.toml b/crates/assists/Cargo.toml
index 3fd8327d6..ed8ad666f 100644
--- a/crates/assists/Cargo.toml
+++ b/crates/assists/Cargo.toml
@@ -11,7 +11,7 @@ doctest = false
11 11
12[dependencies] 12[dependencies]
13rustc-hash = "1.1.0" 13rustc-hash = "1.1.0"
14itertools = "0.9.0" 14itertools = "0.10.0"
15either = "1.6.1" 15either = "1.6.1"
16 16
17stdx = { path = "../stdx", version = "0.0.0" } 17stdx = { path = "../stdx", version = "0.0.0" }
diff --git a/crates/assists/src/assist_config.rs b/crates/assists/src/assist_config.rs
index c458d9054..4fe8ea761 100644
--- a/crates/assists/src/assist_config.rs
+++ b/crates/assists/src/assist_config.rs
@@ -4,8 +4,7 @@
4//! module, and we use to statically check that we only produce snippet 4//! module, and we use to statically check that we only produce snippet
5//! assists if we are allowed to. 5//! assists if we are allowed to.
6 6
7use hir::PrefixKind; 7use ide_db::helpers::{insert_use::MergeBehavior, SnippetCap};
8use ide_db::helpers::insert_use::MergeBehavior;
9 8
10use crate::AssistKind; 9use crate::AssistKind;
11 10
@@ -16,35 +15,8 @@ pub struct AssistConfig {
16 pub insert_use: InsertUseConfig, 15 pub insert_use: InsertUseConfig,
17} 16}
18 17
19impl AssistConfig {
20 pub fn allow_snippets(&mut self, yes: bool) {
21 self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None }
22 }
23}
24
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
26pub struct SnippetCap {
27 _private: (),
28}
29
30impl Default for AssistConfig {
31 fn default() -> Self {
32 AssistConfig {
33 snippet_cap: Some(SnippetCap { _private: () }),
34 allowed: None,
35 insert_use: InsertUseConfig::default(),
36 }
37 }
38}
39
40#[derive(Clone, Copy, Debug, PartialEq, Eq)] 18#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub struct InsertUseConfig { 19pub struct InsertUseConfig {
42 pub merge: Option<MergeBehavior>, 20 pub merge: Option<MergeBehavior>,
43 pub prefix_kind: PrefixKind, 21 pub prefix_kind: hir::PrefixKind,
44}
45
46impl Default for InsertUseConfig {
47 fn default() -> Self {
48 InsertUseConfig { merge: Some(MergeBehavior::Full), prefix_kind: PrefixKind::Plain }
49 }
50} 22}
diff --git a/crates/assists/src/assist_context.rs b/crates/assists/src/assist_context.rs
index 4f59d39a9..91cc63427 100644
--- a/crates/assists/src/assist_context.rs
+++ b/crates/assists/src/assist_context.rs
@@ -4,7 +4,10 @@ use std::mem;
4 4
5use algo::find_covering_element; 5use algo::find_covering_element;
6use hir::Semantics; 6use hir::Semantics;
7use ide_db::base_db::{AnchoredPathBuf, FileId, FileRange}; 7use ide_db::{
8 base_db::{AnchoredPathBuf, FileId, FileRange},
9 helpers::SnippetCap,
10};
8use ide_db::{ 11use ide_db::{
9 label::Label, 12 label::Label,
10 source_change::{FileSystemEdit, SourceChange, SourceFileEdit}, 13 source_change::{FileSystemEdit, SourceChange, SourceFileEdit},
@@ -17,10 +20,7 @@ use syntax::{
17}; 20};
18use text_edit::{TextEdit, TextEditBuilder}; 21use text_edit::{TextEdit, TextEditBuilder};
19 22
20use crate::{ 23use crate::{assist_config::AssistConfig, Assist, AssistId, AssistKind, GroupLabel};
21 assist_config::{AssistConfig, SnippetCap},
22 Assist, AssistId, AssistKind, GroupLabel,
23};
24 24
25/// `AssistContext` allows to apply an assist or check if it could be applied. 25/// `AssistContext` allows to apply an assist or check if it could be applied.
26/// 26///
diff --git a/crates/assists/src/ast_transform.rs b/crates/assists/src/ast_transform.rs
index da94e9987..4a3ed7783 100644
--- a/crates/assists/src/ast_transform.rs
+++ b/crates/assists/src/ast_transform.rs
@@ -204,7 +204,8 @@ impl<'a> AstTransform<'a> for QualifyPaths<'a> {
204 } 204 }
205 PathResolution::Local(_) 205 PathResolution::Local(_)
206 | PathResolution::TypeParam(_) 206 | PathResolution::TypeParam(_)
207 | PathResolution::SelfType(_) => None, 207 | PathResolution::SelfType(_)
208 | PathResolution::ConstParam(_) => None,
208 PathResolution::Macro(_) => None, 209 PathResolution::Macro(_) => None,
209 PathResolution::AssocItem(_) => None, 210 PathResolution::AssocItem(_) => None,
210 } 211 }
diff --git a/crates/assists/src/handlers/add_explicit_type.rs b/crates/assists/src/handlers/add_explicit_type.rs
index 563cbf505..cb1548cef 100644
--- a/crates/assists/src/handlers/add_explicit_type.rs
+++ b/crates/assists/src/handlers/add_explicit_type.rs
@@ -12,7 +12,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
12// 12//
13// ``` 13// ```
14// fn main() { 14// fn main() {
15// let x<|> = 92; 15// let x$0 = 92;
16// } 16// }
17// ``` 17// ```
18// -> 18// ->
@@ -81,21 +81,17 @@ mod tests {
81 81
82 #[test] 82 #[test]
83 fn add_explicit_type_target() { 83 fn add_explicit_type_target() {
84 check_assist_target(add_explicit_type, "fn f() { let a<|> = 1; }", "a"); 84 check_assist_target(add_explicit_type, "fn f() { let a$0 = 1; }", "a");
85 } 85 }
86 86
87 #[test] 87 #[test]
88 fn add_explicit_type_works_for_simple_expr() { 88 fn add_explicit_type_works_for_simple_expr() {
89 check_assist(add_explicit_type, "fn f() { let a<|> = 1; }", "fn f() { let a: i32 = 1; }"); 89 check_assist(add_explicit_type, "fn f() { let a$0 = 1; }", "fn f() { let a: i32 = 1; }");
90 } 90 }
91 91
92 #[test] 92 #[test]
93 fn add_explicit_type_works_for_underscore() { 93 fn add_explicit_type_works_for_underscore() {
94 check_assist( 94 check_assist(add_explicit_type, "fn f() { let a$0: _ = 1; }", "fn f() { let a: i32 = 1; }");
95 add_explicit_type,
96 "fn f() { let a<|>: _ = 1; }",
97 "fn f() { let a: i32 = 1; }",
98 );
99 } 95 }
100 96
101 #[test] 97 #[test]
@@ -109,7 +105,7 @@ mod tests {
109 } 105 }
110 106
111 fn f() { 107 fn f() {
112 let a<|>: Option<_> = Option::Some(1); 108 let a$0: Option<_> = Option::Some(1);
113 }"#, 109 }"#,
114 r#" 110 r#"
115 enum Option<T> { 111 enum Option<T> {
@@ -127,7 +123,7 @@ mod tests {
127 fn add_explicit_type_works_for_macro_call() { 123 fn add_explicit_type_works_for_macro_call() {
128 check_assist( 124 check_assist(
129 add_explicit_type, 125 add_explicit_type,
130 r"macro_rules! v { () => {0u64} } fn f() { let a<|> = v!(); }", 126 r"macro_rules! v { () => {0u64} } fn f() { let a$0 = v!(); }",
131 r"macro_rules! v { () => {0u64} } fn f() { let a: u64 = v!(); }", 127 r"macro_rules! v { () => {0u64} } fn f() { let a: u64 = v!(); }",
132 ); 128 );
133 } 129 }
@@ -136,31 +132,31 @@ mod tests {
136 fn add_explicit_type_works_for_macro_call_recursive() { 132 fn add_explicit_type_works_for_macro_call_recursive() {
137 check_assist( 133 check_assist(
138 add_explicit_type, 134 add_explicit_type,
139 r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|> = v!(); }"#, 135 r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a$0 = v!(); }"#,
140 r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a: u64 = v!(); }"#, 136 r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a: u64 = v!(); }"#,
141 ); 137 );
142 } 138 }
143 139
144 #[test] 140 #[test]
145 fn add_explicit_type_not_applicable_if_ty_not_inferred() { 141 fn add_explicit_type_not_applicable_if_ty_not_inferred() {
146 check_assist_not_applicable(add_explicit_type, "fn f() { let a<|> = None; }"); 142 check_assist_not_applicable(add_explicit_type, "fn f() { let a$0 = None; }");
147 } 143 }
148 144
149 #[test] 145 #[test]
150 fn add_explicit_type_not_applicable_if_ty_already_specified() { 146 fn add_explicit_type_not_applicable_if_ty_already_specified() {
151 check_assist_not_applicable(add_explicit_type, "fn f() { let a<|>: i32 = 1; }"); 147 check_assist_not_applicable(add_explicit_type, "fn f() { let a$0: i32 = 1; }");
152 } 148 }
153 149
154 #[test] 150 #[test]
155 fn add_explicit_type_not_applicable_if_specified_ty_is_tuple() { 151 fn add_explicit_type_not_applicable_if_specified_ty_is_tuple() {
156 check_assist_not_applicable(add_explicit_type, "fn f() { let a<|>: (i32, i32) = (3, 4); }"); 152 check_assist_not_applicable(add_explicit_type, "fn f() { let a$0: (i32, i32) = (3, 4); }");
157 } 153 }
158 154
159 #[test] 155 #[test]
160 fn add_explicit_type_not_applicable_if_cursor_after_equals() { 156 fn add_explicit_type_not_applicable_if_cursor_after_equals() {
161 check_assist_not_applicable( 157 check_assist_not_applicable(
162 add_explicit_type, 158 add_explicit_type,
163 "fn f() {let a =<|> match 1 {2 => 3, 3 => 5};}", 159 "fn f() {let a =$0 match 1 {2 => 3, 3 => 5};}",
164 ) 160 )
165 } 161 }
166 162
@@ -168,7 +164,7 @@ mod tests {
168 fn add_explicit_type_not_applicable_if_cursor_before_let() { 164 fn add_explicit_type_not_applicable_if_cursor_before_let() {
169 check_assist_not_applicable( 165 check_assist_not_applicable(
170 add_explicit_type, 166 add_explicit_type,
171 "fn f() <|>{let a = match 1 {2 => 3, 3 => 5};}", 167 "fn f() $0{let a = match 1 {2 => 3, 3 => 5};}",
172 ) 168 )
173 } 169 }
174 170
@@ -178,7 +174,7 @@ mod tests {
178 add_explicit_type, 174 add_explicit_type,
179 r#" 175 r#"
180fn main() { 176fn main() {
181 let multiply_by_two<|> = |i| i * 3; 177 let multiply_by_two$0 = |i| i * 3;
182 let six = multiply_by_two(2); 178 let six = multiply_by_two(2);
183}"#, 179}"#,
184 ) 180 )
@@ -195,7 +191,7 @@ struct Test<K, T = u8> {
195} 191}
196 192
197fn main() { 193fn main() {
198 let test<|> = Test { t: 23u8, k: 33 }; 194 let test$0 = Test { t: 23u8, k: 33 };
199}"#, 195}"#,
200 r#" 196 r#"
201struct Test<K, T = u8> { 197struct Test<K, T = u8> {
diff --git a/crates/assists/src/handlers/add_missing_impl_members.rs b/crates/assists/src/handlers/add_missing_impl_members.rs
index 7df05b841..63cea754d 100644
--- a/crates/assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/assists/src/handlers/add_missing_impl_members.rs
@@ -20,7 +20,7 @@ use crate::{
20// fn bar(&self) {} 20// fn bar(&self) {}
21// } 21// }
22// 22//
23// impl Trait<u32> for () {<|> 23// impl Trait<u32> for () {$0
24// 24//
25// } 25// }
26// ``` 26// ```
@@ -63,7 +63,7 @@ pub(crate) fn add_missing_impl_members(acc: &mut Assists, ctx: &AssistContext) -
63// 63//
64// impl Trait for () { 64// impl Trait for () {
65// type X = (); 65// type X = ();
66// fn foo(&self) {}<|> 66// fn foo(&self) {}$0
67// 67//
68// } 68// }
69// ``` 69// ```
@@ -166,7 +166,7 @@ struct S;
166 166
167impl Foo for S { 167impl Foo for S {
168 fn bar(&self) {} 168 fn bar(&self) {}
169<|> 169$0
170}"#, 170}"#,
171 r#" 171 r#"
172trait Foo { 172trait Foo {
@@ -214,7 +214,7 @@ struct S;
214 214
215impl Foo for S { 215impl Foo for S {
216 fn bar(&self) {} 216 fn bar(&self) {}
217<|> 217$0
218}"#, 218}"#,
219 r#" 219 r#"
220trait Foo { 220trait Foo {
@@ -242,7 +242,7 @@ impl Foo for S {
242 r#" 242 r#"
243trait Foo { fn foo(&self); } 243trait Foo { fn foo(&self); }
244struct S; 244struct S;
245impl Foo for S { <|> }"#, 245impl Foo for S { $0 }"#,
246 r#" 246 r#"
247trait Foo { fn foo(&self); } 247trait Foo { fn foo(&self); }
248struct S; 248struct S;
@@ -261,7 +261,7 @@ impl Foo for S {
261 r#" 261 r#"
262trait Foo { fn foo(&self); } 262trait Foo { fn foo(&self); }
263struct S; 263struct S;
264impl Foo for S<|>"#, 264impl Foo for S$0"#,
265 r#" 265 r#"
266trait Foo { fn foo(&self); } 266trait Foo { fn foo(&self); }
267struct S; 267struct S;
@@ -280,7 +280,7 @@ impl Foo for S {
280 r#" 280 r#"
281trait Foo<T> { fn foo(&self, t: T) -> &T; } 281trait Foo<T> { fn foo(&self, t: T) -> &T; }
282struct S; 282struct S;
283impl Foo<u32> for S { <|> }"#, 283impl Foo<u32> for S { $0 }"#,
284 r#" 284 r#"
285trait Foo<T> { fn foo(&self, t: T) -> &T; } 285trait Foo<T> { fn foo(&self, t: T) -> &T; }
286struct S; 286struct S;
@@ -299,7 +299,7 @@ impl Foo<u32> for S {
299 r#" 299 r#"
300trait Foo<T> { fn foo(&self, t: T) -> &T; } 300trait Foo<T> { fn foo(&self, t: T) -> &T; }
301struct S; 301struct S;
302impl<U> Foo<U> for S { <|> }"#, 302impl<U> Foo<U> for S { $0 }"#,
303 r#" 303 r#"
304trait Foo<T> { fn foo(&self, t: T) -> &T; } 304trait Foo<T> { fn foo(&self, t: T) -> &T; }
305struct S; 305struct S;
@@ -318,7 +318,7 @@ impl<U> Foo<U> for S {
318 r#" 318 r#"
319trait Foo { fn foo(&self); } 319trait Foo { fn foo(&self); }
320struct S; 320struct S;
321impl Foo for S {}<|>"#, 321impl Foo for S {}$0"#,
322 r#" 322 r#"
323trait Foo { fn foo(&self); } 323trait Foo { fn foo(&self); }
324struct S; 324struct S;
@@ -340,7 +340,7 @@ mod foo {
340 trait Foo { fn foo(&self, bar: Bar); } 340 trait Foo { fn foo(&self, bar: Bar); }
341} 341}
342struct S; 342struct S;
343impl foo::Foo for S { <|> }"#, 343impl foo::Foo for S { $0 }"#,
344 r#" 344 r#"
345mod foo { 345mod foo {
346 pub struct Bar; 346 pub struct Bar;
@@ -370,7 +370,7 @@ mod foo {
370use foo::bar; 370use foo::bar;
371 371
372struct S; 372struct S;
373impl bar::Foo for S { <|> }"#, 373impl bar::Foo for S { $0 }"#,
374 r#" 374 r#"
375mod foo { 375mod foo {
376 pub mod bar { 376 pub mod bar {
@@ -400,7 +400,7 @@ mod foo {
400 trait Foo { fn foo(&self, bar: Bar<u32>); } 400 trait Foo { fn foo(&self, bar: Bar<u32>); }
401} 401}
402struct S; 402struct S;
403impl foo::Foo for S { <|> }"#, 403impl foo::Foo for S { $0 }"#,
404 r#" 404 r#"
405mod foo { 405mod foo {
406 pub struct Bar<T>; 406 pub struct Bar<T>;
@@ -425,7 +425,7 @@ mod foo {
425 trait Foo<T> { fn foo(&self, bar: Bar<T>); } 425 trait Foo<T> { fn foo(&self, bar: Bar<T>); }
426} 426}
427struct S; 427struct S;
428impl foo::Foo<u32> for S { <|> }"#, 428impl foo::Foo<u32> for S { $0 }"#,
429 r#" 429 r#"
430mod foo { 430mod foo {
431 pub struct Bar<T>; 431 pub struct Bar<T>;
@@ -452,7 +452,7 @@ mod foo {
452} 452}
453struct Param; 453struct Param;
454struct S; 454struct S;
455impl foo::Foo<Param> for S { <|> }"#, 455impl foo::Foo<Param> for S { $0 }"#,
456 r#" 456 r#"
457mod foo { 457mod foo {
458 trait Foo<T> { fn foo(&self, bar: T); } 458 trait Foo<T> { fn foo(&self, bar: T); }
@@ -479,7 +479,7 @@ mod foo {
479 trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); } 479 trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
480} 480}
481struct S; 481struct S;
482impl foo::Foo for S { <|> }"#, 482impl foo::Foo for S { $0 }"#,
483 r#" 483 r#"
484mod foo { 484mod foo {
485 pub struct Bar<T>; 485 pub struct Bar<T>;
@@ -506,7 +506,7 @@ mod foo {
506 trait Foo { fn foo(&self, bar: Bar<Baz>); } 506 trait Foo { fn foo(&self, bar: Bar<Baz>); }
507} 507}
508struct S; 508struct S;
509impl foo::Foo for S { <|> }"#, 509impl foo::Foo for S { $0 }"#,
510 r#" 510 r#"
511mod foo { 511mod foo {
512 pub struct Bar<T>; 512 pub struct Bar<T>;
@@ -532,7 +532,7 @@ mod foo {
532 trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); } 532 trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); }
533} 533}
534struct S; 534struct S;
535impl foo::Foo for S { <|> }"#, 535impl foo::Foo for S { $0 }"#,
536 r#" 536 r#"
537mod foo { 537mod foo {
538 pub trait Fn<Args> { type Output; } 538 pub trait Fn<Args> { type Output; }
@@ -554,7 +554,7 @@ impl foo::Foo for S {
554 r#" 554 r#"
555trait Foo; 555trait Foo;
556struct S; 556struct S;
557impl Foo for S { <|> }"#, 557impl Foo for S { $0 }"#,
558 ) 558 )
559 } 559 }
560 560
@@ -568,7 +568,7 @@ trait Foo {
568 fn valid(some: u32) -> bool { false } 568 fn valid(some: u32) -> bool { false }
569} 569}
570struct S; 570struct S;
571impl Foo for S { <|> }"#, 571impl Foo for S { $0 }"#,
572 ) 572 )
573 } 573 }
574 574
@@ -586,7 +586,7 @@ trait Foo {
586 fn foo(&self); 586 fn foo(&self);
587} 587}
588struct S; 588struct S;
589impl Foo for S {}<|>"#, 589impl Foo for S {}$0"#,
590 r#" 590 r#"
591#[doc(alias = "test alias")] 591#[doc(alias = "test alias")]
592trait Foo { 592trait Foo {
@@ -621,7 +621,7 @@ trait Foo {
621 fn foo(some: u32) -> bool; 621 fn foo(some: u32) -> bool;
622} 622}
623struct S; 623struct S;
624impl Foo for S { <|> }"#, 624impl Foo for S { $0 }"#,
625 r#" 625 r#"
626trait Foo { 626trait Foo {
627 type Output; 627 type Output;
@@ -648,7 +648,7 @@ trait Foo<T = Self> {
648} 648}
649 649
650struct S; 650struct S;
651impl Foo for S { <|> }"#, 651impl Foo for S { $0 }"#,
652 r#" 652 r#"
653trait Foo<T = Self> { 653trait Foo<T = Self> {
654 fn bar(&self, other: &T); 654 fn bar(&self, other: &T);
@@ -673,7 +673,7 @@ trait Foo<T1, T2 = Self> {
673} 673}
674 674
675struct S<T>; 675struct S<T>;
676impl Foo<T> for S<T> { <|> }"#, 676impl Foo<T> for S<T> { $0 }"#,
677 r#" 677 r#"
678trait Foo<T1, T2 = Self> { 678trait Foo<T1, T2 = Self> {
679 fn bar(&self, this: &T1, that: &T2); 679 fn bar(&self, this: &T1, that: &T2);
@@ -697,7 +697,7 @@ trait Tr {
697 type Ty: Copy + 'static; 697 type Ty: Copy + 'static;
698} 698}
699 699
700impl Tr for ()<|> { 700impl Tr for ()$0 {
701}"#, 701}"#,
702 r#" 702 r#"
703trait Tr { 703trait Tr {
@@ -719,7 +719,7 @@ trait Tr {
719 fn foo(); 719 fn foo();
720} 720}
721 721
722impl Tr for ()<|> { 722impl Tr for ()$0 {
723 +++ 723 +++
724}"#, 724}"#,
725 r#" 725 r#"
@@ -745,7 +745,7 @@ trait Tr {
745 fn foo(); 745 fn foo();
746} 746}
747 747
748impl Tr for ()<|> { 748impl Tr for ()$0 {
749 // very important 749 // very important
750}"#, 750}"#,
751 r#" 751 r#"
@@ -771,7 +771,7 @@ trait Test {
771 fn foo(&self, x: crate) 771 fn foo(&self, x: crate)
772} 772}
773impl Test for () { 773impl Test for () {
774 <|> 774 $0
775} 775}
776"#, 776"#,
777 r#" 777 r#"
@@ -796,7 +796,7 @@ trait Foo<BAR> {
796 fn foo(&self, bar: BAR); 796 fn foo(&self, bar: BAR);
797} 797}
798impl Foo for () { 798impl Foo for () {
799 <|> 799 $0
800} 800}
801"#, 801"#,
802 r#" 802 r#"
diff --git a/crates/assists/src/handlers/add_turbo_fish.rs b/crates/assists/src/handlers/add_turbo_fish.rs
index 1f486c013..8e9ea4fad 100644
--- a/crates/assists/src/handlers/add_turbo_fish.rs
+++ b/crates/assists/src/handlers/add_turbo_fish.rs
@@ -14,7 +14,7 @@ use crate::{
14// ``` 14// ```
15// fn make<T>() -> T { todo!() } 15// fn make<T>() -> T { todo!() }
16// fn main() { 16// fn main() {
17// let x = make<|>(); 17// let x = make$0();
18// } 18// }
19// ``` 19// ```
20// -> 20// ->
@@ -77,7 +77,7 @@ mod tests {
77 r#" 77 r#"
78fn make<T>() -> T {} 78fn make<T>() -> T {}
79fn main() { 79fn main() {
80 make<|>(); 80 make$0();
81} 81}
82"#, 82"#,
83 r#" 83 r#"
@@ -97,7 +97,7 @@ fn main() {
97 r#" 97 r#"
98fn make<T>() -> T {} 98fn make<T>() -> T {}
99fn main() { 99fn main() {
100 make()<|>; 100 make()$0;
101} 101}
102"#, 102"#,
103 r#" 103 r#"
@@ -119,7 +119,7 @@ impl S {
119 fn make<T>(&self) -> T {} 119 fn make<T>(&self) -> T {}
120} 120}
121fn main() { 121fn main() {
122 S.make<|>(); 122 S.make$0();
123} 123}
124"#, 124"#,
125 r#" 125 r#"
@@ -142,7 +142,7 @@ fn main() {
142 r#" 142 r#"
143fn make<T>() -> T {} 143fn make<T>() -> T {}
144fn main() { 144fn main() {
145 make<|>::<()>(); 145 make$0::<()>();
146} 146}
147"#, 147"#,
148 ); 148 );
@@ -156,7 +156,7 @@ fn main() {
156 r#" 156 r#"
157fn make() -> () {} 157fn make() -> () {}
158fn main() { 158fn main() {
159 make<|>(); 159 make$0();
160} 160}
161"#, 161"#,
162 ); 162 );
diff --git a/crates/assists/src/handlers/apply_demorgan.rs b/crates/assists/src/handlers/apply_demorgan.rs
index 1a6fdafda..ed4d11455 100644
--- a/crates/assists/src/handlers/apply_demorgan.rs
+++ b/crates/assists/src/handlers/apply_demorgan.rs
@@ -12,7 +12,7 @@ use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKin
12// 12//
13// ``` 13// ```
14// fn main() { 14// fn main() {
15// if x != 4 ||<|> !y {} 15// if x != 4 ||$0 !y {}
16// } 16// }
17// ``` 17// ```
18// -> 18// ->
@@ -68,26 +68,26 @@ mod tests {
68 68
69 #[test] 69 #[test]
70 fn demorgan_turns_and_into_or() { 70 fn demorgan_turns_and_into_or() {
71 check_assist(apply_demorgan, "fn f() { !x &&<|> !x }", "fn f() { !(x || x) }") 71 check_assist(apply_demorgan, "fn f() { !x &&$0 !x }", "fn f() { !(x || x) }")
72 } 72 }
73 73
74 #[test] 74 #[test]
75 fn demorgan_turns_or_into_and() { 75 fn demorgan_turns_or_into_and() {
76 check_assist(apply_demorgan, "fn f() { !x ||<|> !x }", "fn f() { !(x && x) }") 76 check_assist(apply_demorgan, "fn f() { !x ||$0 !x }", "fn f() { !(x && x) }")
77 } 77 }
78 78
79 #[test] 79 #[test]
80 fn demorgan_removes_inequality() { 80 fn demorgan_removes_inequality() {
81 check_assist(apply_demorgan, "fn f() { x != x ||<|> !x }", "fn f() { !(x == x && x) }") 81 check_assist(apply_demorgan, "fn f() { x != x ||$0 !x }", "fn f() { !(x == x && x) }")
82 } 82 }
83 83
84 #[test] 84 #[test]
85 fn demorgan_general_case() { 85 fn demorgan_general_case() {
86 check_assist(apply_demorgan, "fn f() { x ||<|> x }", "fn f() { !(!x && !x) }") 86 check_assist(apply_demorgan, "fn f() { x ||$0 x }", "fn f() { !(!x && !x) }")
87 } 87 }
88 88
89 #[test] 89 #[test]
90 fn demorgan_doesnt_apply_with_cursor_not_on_op() { 90 fn demorgan_doesnt_apply_with_cursor_not_on_op() {
91 check_assist_not_applicable(apply_demorgan, "fn f() { <|> !x || !x }") 91 check_assist_not_applicable(apply_demorgan, "fn f() { $0 !x || !x }")
92 } 92 }
93} 93}
diff --git a/crates/assists/src/handlers/auto_import.rs b/crates/assists/src/handlers/auto_import.rs
index bd5bba646..55620f0f3 100644
--- a/crates/assists/src/handlers/auto_import.rs
+++ b/crates/assists/src/handlers/auto_import.rs
@@ -70,7 +70,7 @@ use crate::{
70// 70//
71// ``` 71// ```
72// fn main() { 72// fn main() {
73// let map = HashMap<|>::new(); 73// let map = HashMap$0::new();
74// } 74// }
75// # pub mod std { pub mod collections { pub struct HashMap { } } } 75// # pub mod std { pub mod collections { pub struct HashMap { } } }
76// ``` 76// ```
@@ -151,7 +151,7 @@ mod tests {
151 151
152 use std::fmt; 152 use std::fmt;
153 153
154 <|>Formatter 154 $0Formatter
155 ", 155 ",
156 r" 156 r"
157 mod std { 157 mod std {
@@ -172,7 +172,7 @@ mod tests {
172 check_assist( 172 check_assist(
173 auto_import, 173 auto_import,
174 r" 174 r"
175 <|>PubStruct 175 $0PubStruct
176 176
177 pub mod PubMod { 177 pub mod PubMod {
178 pub struct PubStruct; 178 pub struct PubStruct;
@@ -198,7 +198,7 @@ mod tests {
198 macro_rules! foo { 198 macro_rules! foo {
199 ($i:ident) => { fn foo(a: $i) {} } 199 ($i:ident) => { fn foo(a: $i) {} }
200 } 200 }
201 foo!(Pub<|>Struct); 201 foo!(Pub$0Struct);
202 202
203 pub mod PubMod { 203 pub mod PubMod {
204 pub struct PubStruct; 204 pub struct PubStruct;
@@ -227,7 +227,7 @@ mod tests {
227 use PubMod::PubStruct1; 227 use PubMod::PubStruct1;
228 228
229 struct Test { 229 struct Test {
230 test: Pub<|>Struct2<u8>, 230 test: Pub$0Struct2<u8>,
231 } 231 }
232 232
233 pub mod PubMod { 233 pub mod PubMod {
@@ -259,7 +259,7 @@ mod tests {
259 check_assist( 259 check_assist(
260 auto_import, 260 auto_import,
261 r" 261 r"
262 PubSt<|>ruct 262 PubSt$0ruct
263 263
264 pub mod PubMod1 { 264 pub mod PubMod1 {
265 pub struct PubStruct; 265 pub struct PubStruct;
@@ -296,7 +296,7 @@ mod tests {
296 r" 296 r"
297 use PubMod::PubStruct; 297 use PubMod::PubStruct;
298 298
299 PubStruct<|> 299 PubStruct$0
300 300
301 pub mod PubMod { 301 pub mod PubMod {
302 pub struct PubStruct; 302 pub struct PubStruct;
@@ -310,7 +310,7 @@ mod tests {
310 check_assist_not_applicable( 310 check_assist_not_applicable(
311 auto_import, 311 auto_import,
312 r" 312 r"
313 PrivateStruct<|> 313 PrivateStruct$0
314 314
315 pub mod PubMod { 315 pub mod PubMod {
316 struct PrivateStruct; 316 struct PrivateStruct;
@@ -324,7 +324,7 @@ mod tests {
324 check_assist_not_applicable( 324 check_assist_not_applicable(
325 auto_import, 325 auto_import,
326 " 326 "
327 PubStruct<|>", 327 PubStruct$0",
328 ); 328 );
329 } 329 }
330 330
@@ -333,7 +333,7 @@ mod tests {
333 check_assist_not_applicable( 333 check_assist_not_applicable(
334 auto_import, 334 auto_import,
335 r" 335 r"
336 use PubStruct<|>; 336 use PubStruct$0;
337 337
338 pub mod PubMod { 338 pub mod PubMod {
339 pub struct PubStruct; 339 pub struct PubStruct;
@@ -346,7 +346,7 @@ mod tests {
346 check_assist( 346 check_assist(
347 auto_import, 347 auto_import,
348 r" 348 r"
349 test_function<|> 349 test_function$0
350 350
351 pub mod PubMod { 351 pub mod PubMod {
352 pub fn test_function() {}; 352 pub fn test_function() {};
@@ -377,7 +377,7 @@ macro_rules! foo {
377 377
378//- /main.rs crate:main deps:crate_with_macro 378//- /main.rs crate:main deps:crate_with_macro
379fn main() { 379fn main() {
380 foo<|> 380 foo$0
381} 381}
382", 382",
383 r"use crate_with_macro::foo; 383 r"use crate_with_macro::foo;
@@ -395,7 +395,7 @@ fn main() {
395 auto_import, 395 auto_import,
396 r" 396 r"
397 struct AssistInfo { 397 struct AssistInfo {
398 group_label: Option<<|>GroupLabel>, 398 group_label: Option<$0GroupLabel>,
399 } 399 }
400 400
401 mod m { pub struct GroupLabel; } 401 mod m { pub struct GroupLabel; }
@@ -419,7 +419,7 @@ fn main() {
419 419
420 use mod1::mod2; 420 use mod1::mod2;
421 fn main() { 421 fn main() {
422 mod2::mod3::TestStruct<|> 422 mod2::mod3::TestStruct$0
423 } 423 }
424 ", 424 ",
425 ); 425 );
@@ -436,7 +436,7 @@ fn main() {
436 436
437 use test_mod::test_function; 437 use test_mod::test_function;
438 fn main() { 438 fn main() {
439 test_function<|> 439 test_function$0
440 } 440 }
441 ", 441 ",
442 ); 442 );
@@ -455,7 +455,7 @@ fn main() {
455 } 455 }
456 456
457 fn main() { 457 fn main() {
458 TestStruct::test_function<|> 458 TestStruct::test_function$0
459 } 459 }
460 ", 460 ",
461 r" 461 r"
@@ -488,7 +488,7 @@ fn main() {
488 } 488 }
489 489
490 fn main() { 490 fn main() {
491 TestStruct::TEST_CONST<|> 491 TestStruct::TEST_CONST$0
492 } 492 }
493 ", 493 ",
494 r" 494 r"
@@ -524,7 +524,7 @@ fn main() {
524 } 524 }
525 525
526 fn main() { 526 fn main() {
527 test_mod::TestStruct::test_function<|> 527 test_mod::TestStruct::test_function$0
528 } 528 }
529 ", 529 ",
530 r" 530 r"
@@ -573,7 +573,7 @@ fn main() {
573 573
574 use test_mod::TestTrait2; 574 use test_mod::TestTrait2;
575 fn main() { 575 fn main() {
576 test_mod::TestEnum::test_function<|>; 576 test_mod::TestEnum::test_function$0;
577 } 577 }
578 ", 578 ",
579 ) 579 )
@@ -595,7 +595,7 @@ fn main() {
595 } 595 }
596 596
597 fn main() { 597 fn main() {
598 test_mod::TestStruct::TEST_CONST<|> 598 test_mod::TestStruct::TEST_CONST$0
599 } 599 }
600 ", 600 ",
601 r" 601 r"
@@ -644,7 +644,7 @@ fn main() {
644 644
645 use test_mod::TestTrait2; 645 use test_mod::TestTrait2;
646 fn main() { 646 fn main() {
647 test_mod::TestEnum::TEST_CONST<|>; 647 test_mod::TestEnum::TEST_CONST$0;
648 } 648 }
649 ", 649 ",
650 ) 650 )
@@ -667,7 +667,7 @@ fn main() {
667 667
668 fn main() { 668 fn main() {
669 let test_struct = test_mod::TestStruct {}; 669 let test_struct = test_mod::TestStruct {};
670 test_struct.test_meth<|>od() 670 test_struct.test_meth$0od()
671 } 671 }
672 ", 672 ",
673 r" 673 r"
@@ -699,7 +699,7 @@ fn main() {
699 //- /main.rs crate:main deps:dep 699 //- /main.rs crate:main deps:dep
700 fn main() { 700 fn main() {
701 let test_struct = dep::test_mod::TestStruct {}; 701 let test_struct = dep::test_mod::TestStruct {};
702 test_struct.test_meth<|>od() 702 test_struct.test_meth$0od()
703 } 703 }
704 //- /dep.rs crate:dep 704 //- /dep.rs crate:dep
705 pub mod test_mod { 705 pub mod test_mod {
@@ -730,7 +730,7 @@ fn main() {
730 r" 730 r"
731 //- /main.rs crate:main deps:dep 731 //- /main.rs crate:main deps:dep
732 fn main() { 732 fn main() {
733 dep::test_mod::TestStruct::test_func<|>tion 733 dep::test_mod::TestStruct::test_func$0tion
734 } 734 }
735 //- /dep.rs crate:dep 735 //- /dep.rs crate:dep
736 pub mod test_mod { 736 pub mod test_mod {
@@ -760,7 +760,7 @@ fn main() {
760 r" 760 r"
761 //- /main.rs crate:main deps:dep 761 //- /main.rs crate:main deps:dep
762 fn main() { 762 fn main() {
763 dep::test_mod::TestStruct::CONST<|> 763 dep::test_mod::TestStruct::CONST$0
764 } 764 }
765 //- /dep.rs crate:dep 765 //- /dep.rs crate:dep
766 pub mod test_mod { 766 pub mod test_mod {
@@ -791,7 +791,7 @@ fn main() {
791 //- /main.rs crate:main deps:dep 791 //- /main.rs crate:main deps:dep
792 fn main() { 792 fn main() {
793 let test_struct = dep::test_mod::TestStruct {}; 793 let test_struct = dep::test_mod::TestStruct {};
794 test_struct.test_func<|>tion() 794 test_struct.test_func$0tion()
795 } 795 }
796 //- /dep.rs crate:dep 796 //- /dep.rs crate:dep
797 pub mod test_mod { 797 pub mod test_mod {
@@ -815,7 +815,7 @@ fn main() {
815 //- /main.rs crate:main deps:dep 815 //- /main.rs crate:main deps:dep
816 fn main() { 816 fn main() {
817 let test_struct = dep::test_mod::TestStruct {}; 817 let test_struct = dep::test_mod::TestStruct {};
818 test_struct.test_meth<|>od() 818 test_struct.test_meth$0od()
819 } 819 }
820 //- /dep.rs crate:dep 820 //- /dep.rs crate:dep
821 pub mod test_mod { 821 pub mod test_mod {
@@ -858,7 +858,7 @@ fn main() {
858 use test_mod::TestTrait2; 858 use test_mod::TestTrait2;
859 fn main() { 859 fn main() {
860 let one = test_mod::TestEnum::One; 860 let one = test_mod::TestEnum::One;
861 one.test<|>_method(); 861 one.test$0_method();
862 } 862 }
863 ", 863 ",
864 ) 864 )
@@ -874,7 +874,7 @@ pub struct Struct;
874 874
875//- /main.rs crate:main deps:dep 875//- /main.rs crate:main deps:dep
876fn main() { 876fn main() {
877 Struct<|> 877 Struct$0
878} 878}
879", 879",
880 r"use dep::Struct; 880 r"use dep::Struct;
@@ -902,7 +902,7 @@ pub fn panic_fmt() {}
902//- /main.rs crate:main deps:dep 902//- /main.rs crate:main deps:dep
903struct S; 903struct S;
904 904
905impl f<|>mt::Display for S {} 905impl f$0mt::Display for S {}
906", 906",
907 r"use dep::fmt; 907 r"use dep::fmt;
908 908
@@ -930,7 +930,7 @@ mac!();
930 930
931//- /main.rs crate:main deps:dep 931//- /main.rs crate:main deps:dep
932fn main() { 932fn main() {
933 Cheese<|>; 933 Cheese$0;
934} 934}
935", 935",
936 r"use dep::Cheese; 936 r"use dep::Cheese;
@@ -954,7 +954,7 @@ pub struct fmt;
954 954
955//- /main.rs crate:main deps:dep 955//- /main.rs crate:main deps:dep
956fn main() { 956fn main() {
957 FMT<|>; 957 FMT$0;
958} 958}
959", 959",
960 r"use dep::FMT; 960 r"use dep::FMT;
diff --git a/crates/assists/src/handlers/change_visibility.rs b/crates/assists/src/handlers/change_visibility.rs
index 22d7c95d9..ac8c44124 100644
--- a/crates/assists/src/handlers/change_visibility.rs
+++ b/crates/assists/src/handlers/change_visibility.rs
@@ -13,7 +13,7 @@ use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists};
13// Adds or changes existing visibility specifier. 13// Adds or changes existing visibility specifier.
14// 14//
15// ``` 15// ```
16// <|>fn frobnicate() {} 16// $0fn frobnicate() {}
17// ``` 17// ```
18// -> 18// ->
19// ``` 19// ```
@@ -118,23 +118,23 @@ mod tests {
118 118
119 #[test] 119 #[test]
120 fn change_visibility_adds_pub_crate_to_items() { 120 fn change_visibility_adds_pub_crate_to_items() {
121 check_assist(change_visibility, "<|>fn foo() {}", "pub(crate) fn foo() {}"); 121 check_assist(change_visibility, "$0fn foo() {}", "pub(crate) fn foo() {}");
122 check_assist(change_visibility, "f<|>n foo() {}", "pub(crate) fn foo() {}"); 122 check_assist(change_visibility, "f$0n foo() {}", "pub(crate) fn foo() {}");
123 check_assist(change_visibility, "<|>struct Foo {}", "pub(crate) struct Foo {}"); 123 check_assist(change_visibility, "$0struct Foo {}", "pub(crate) struct Foo {}");
124 check_assist(change_visibility, "<|>mod foo {}", "pub(crate) mod foo {}"); 124 check_assist(change_visibility, "$0mod foo {}", "pub(crate) mod foo {}");
125 check_assist(change_visibility, "<|>trait Foo {}", "pub(crate) trait Foo {}"); 125 check_assist(change_visibility, "$0trait Foo {}", "pub(crate) trait Foo {}");
126 check_assist(change_visibility, "m<|>od {}", "pub(crate) mod {}"); 126 check_assist(change_visibility, "m$0od {}", "pub(crate) mod {}");
127 check_assist(change_visibility, "unsafe f<|>n foo() {}", "pub(crate) unsafe fn foo() {}"); 127 check_assist(change_visibility, "unsafe f$0n foo() {}", "pub(crate) unsafe fn foo() {}");
128 } 128 }
129 129
130 #[test] 130 #[test]
131 fn change_visibility_works_with_struct_fields() { 131 fn change_visibility_works_with_struct_fields() {
132 check_assist( 132 check_assist(
133 change_visibility, 133 change_visibility,
134 r"struct S { <|>field: u32 }", 134 r"struct S { $0field: u32 }",
135 r"struct S { pub(crate) field: u32 }", 135 r"struct S { pub(crate) field: u32 }",
136 ); 136 );
137 check_assist(change_visibility, r"struct S ( <|>u32 )", r"struct S ( pub(crate) u32 )"); 137 check_assist(change_visibility, r"struct S ( $0u32 )", r"struct S ( pub(crate) u32 )");
138 } 138 }
139 139
140 #[test] 140 #[test]
@@ -142,33 +142,33 @@ mod tests {
142 mark::check!(change_visibility_field_false_positive); 142 mark::check!(change_visibility_field_false_positive);
143 check_assist_not_applicable( 143 check_assist_not_applicable(
144 change_visibility, 144 change_visibility,
145 r"struct S { field: [(); { let <|>x = ();}] }", 145 r"struct S { field: [(); { let $0x = ();}] }",
146 ) 146 )
147 } 147 }
148 148
149 #[test] 149 #[test]
150 fn change_visibility_pub_to_pub_crate() { 150 fn change_visibility_pub_to_pub_crate() {
151 check_assist(change_visibility, "<|>pub fn foo() {}", "pub(crate) fn foo() {}") 151 check_assist(change_visibility, "$0pub fn foo() {}", "pub(crate) fn foo() {}")
152 } 152 }
153 153
154 #[test] 154 #[test]
155 fn change_visibility_pub_crate_to_pub() { 155 fn change_visibility_pub_crate_to_pub() {
156 check_assist(change_visibility, "<|>pub(crate) fn foo() {}", "pub fn foo() {}") 156 check_assist(change_visibility, "$0pub(crate) fn foo() {}", "pub fn foo() {}")
157 } 157 }
158 158
159 #[test] 159 #[test]
160 fn change_visibility_const() { 160 fn change_visibility_const() {
161 check_assist(change_visibility, "<|>const FOO = 3u8;", "pub(crate) const FOO = 3u8;"); 161 check_assist(change_visibility, "$0const FOO = 3u8;", "pub(crate) const FOO = 3u8;");
162 } 162 }
163 163
164 #[test] 164 #[test]
165 fn change_visibility_static() { 165 fn change_visibility_static() {
166 check_assist(change_visibility, "<|>static FOO = 3u8;", "pub(crate) static FOO = 3u8;"); 166 check_assist(change_visibility, "$0static FOO = 3u8;", "pub(crate) static FOO = 3u8;");
167 } 167 }
168 168
169 #[test] 169 #[test]
170 fn change_visibility_type_alias() { 170 fn change_visibility_type_alias() {
171 check_assist(change_visibility, "<|>type T = ();", "pub(crate) type T = ();"); 171 check_assist(change_visibility, "$0type T = ();", "pub(crate) type T = ();");
172 } 172 }
173 173
174 #[test] 174 #[test]
@@ -181,7 +181,7 @@ mod tests {
181 // comments 181 // comments
182 182
183 #[derive(Debug)] 183 #[derive(Debug)]
184 <|>struct Foo; 184 $0struct Foo;
185 ", 185 ",
186 r" 186 r"
187 /// docs 187 /// docs
@@ -199,14 +199,14 @@ mod tests {
199 check_assist_not_applicable( 199 check_assist_not_applicable(
200 change_visibility, 200 change_visibility,
201 r"mod foo { pub enum Foo {Foo1} } 201 r"mod foo { pub enum Foo {Foo1} }
202 fn main() { foo::Foo::Foo1<|> } ", 202 fn main() { foo::Foo::Foo1$0 } ",
203 ); 203 );
204 } 204 }
205 205
206 #[test] 206 #[test]
207 fn change_visibility_target() { 207 fn change_visibility_target() {
208 check_assist_target(change_visibility, "<|>fn foo() {}", "fn"); 208 check_assist_target(change_visibility, "$0fn foo() {}", "fn");
209 check_assist_target(change_visibility, "pub(crate)<|> fn foo() {}", "pub(crate)"); 209 check_assist_target(change_visibility, "pub(crate)$0 fn foo() {}", "pub(crate)");
210 check_assist_target(change_visibility, "struct S { <|>field: u32 }", "field"); 210 check_assist_target(change_visibility, "struct S { $0field: u32 }", "field");
211 } 211 }
212} 212}
diff --git a/crates/assists/src/handlers/convert_integer_literal.rs b/crates/assists/src/handlers/convert_integer_literal.rs
index 667115382..a8a819cfc 100644
--- a/crates/assists/src/handlers/convert_integer_literal.rs
+++ b/crates/assists/src/handlers/convert_integer_literal.rs
@@ -7,7 +7,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel};
7// Converts the base of integer literals to other bases. 7// Converts the base of integer literals to other bases.
8// 8//
9// ``` 9// ```
10// const _: i32 = 10<|>; 10// const _: i32 = 10$0;
11// ``` 11// ```
12// -> 12// ->
13// ``` 13// ```
@@ -65,47 +65,47 @@ mod tests {
65 65
66 #[test] 66 #[test]
67 fn binary_target() { 67 fn binary_target() {
68 check_assist_target(convert_integer_literal, "const _: i32 = 0b1010<|>;", "0b1010"); 68 check_assist_target(convert_integer_literal, "const _: i32 = 0b1010$0;", "0b1010");
69 } 69 }
70 70
71 #[test] 71 #[test]
72 fn octal_target() { 72 fn octal_target() {
73 check_assist_target(convert_integer_literal, "const _: i32 = 0o12<|>;", "0o12"); 73 check_assist_target(convert_integer_literal, "const _: i32 = 0o12$0;", "0o12");
74 } 74 }
75 75
76 #[test] 76 #[test]
77 fn decimal_target() { 77 fn decimal_target() {
78 check_assist_target(convert_integer_literal, "const _: i32 = 10<|>;", "10"); 78 check_assist_target(convert_integer_literal, "const _: i32 = 10$0;", "10");
79 } 79 }
80 80
81 #[test] 81 #[test]
82 fn hexadecimal_target() { 82 fn hexadecimal_target() {
83 check_assist_target(convert_integer_literal, "const _: i32 = 0xA<|>;", "0xA"); 83 check_assist_target(convert_integer_literal, "const _: i32 = 0xA$0;", "0xA");
84 } 84 }
85 85
86 #[test] 86 #[test]
87 fn binary_target_with_underscores() { 87 fn binary_target_with_underscores() {
88 check_assist_target(convert_integer_literal, "const _: i32 = 0b10_10<|>;", "0b10_10"); 88 check_assist_target(convert_integer_literal, "const _: i32 = 0b10_10$0;", "0b10_10");
89 } 89 }
90 90
91 #[test] 91 #[test]
92 fn octal_target_with_underscores() { 92 fn octal_target_with_underscores() {
93 check_assist_target(convert_integer_literal, "const _: i32 = 0o1_2<|>;", "0o1_2"); 93 check_assist_target(convert_integer_literal, "const _: i32 = 0o1_2$0;", "0o1_2");
94 } 94 }
95 95
96 #[test] 96 #[test]
97 fn decimal_target_with_underscores() { 97 fn decimal_target_with_underscores() {
98 check_assist_target(convert_integer_literal, "const _: i32 = 1_0<|>;", "1_0"); 98 check_assist_target(convert_integer_literal, "const _: i32 = 1_0$0;", "1_0");
99 } 99 }
100 100
101 #[test] 101 #[test]
102 fn hexadecimal_target_with_underscores() { 102 fn hexadecimal_target_with_underscores() {
103 check_assist_target(convert_integer_literal, "const _: i32 = 0x_A<|>;", "0x_A"); 103 check_assist_target(convert_integer_literal, "const _: i32 = 0x_A$0;", "0x_A");
104 } 104 }
105 105
106 #[test] 106 #[test]
107 fn convert_decimal_integer() { 107 fn convert_decimal_integer() {
108 let before = "const _: i32 = 1000<|>;"; 108 let before = "const _: i32 = 1000$0;";
109 109
110 check_assist_by_label( 110 check_assist_by_label(
111 convert_integer_literal, 111 convert_integer_literal,
@@ -131,7 +131,7 @@ mod tests {
131 131
132 #[test] 132 #[test]
133 fn convert_hexadecimal_integer() { 133 fn convert_hexadecimal_integer() {
134 let before = "const _: i32 = 0xFF<|>;"; 134 let before = "const _: i32 = 0xFF$0;";
135 135
136 check_assist_by_label( 136 check_assist_by_label(
137 convert_integer_literal, 137 convert_integer_literal,
@@ -157,7 +157,7 @@ mod tests {
157 157
158 #[test] 158 #[test]
159 fn convert_binary_integer() { 159 fn convert_binary_integer() {
160 let before = "const _: i32 = 0b11111111<|>;"; 160 let before = "const _: i32 = 0b11111111$0;";
161 161
162 check_assist_by_label( 162 check_assist_by_label(
163 convert_integer_literal, 163 convert_integer_literal,
@@ -183,7 +183,7 @@ mod tests {
183 183
184 #[test] 184 #[test]
185 fn convert_octal_integer() { 185 fn convert_octal_integer() {
186 let before = "const _: i32 = 0o377<|>;"; 186 let before = "const _: i32 = 0o377$0;";
187 187
188 check_assist_by_label( 188 check_assist_by_label(
189 convert_integer_literal, 189 convert_integer_literal,
@@ -209,7 +209,7 @@ mod tests {
209 209
210 #[test] 210 #[test]
211 fn convert_integer_with_underscores() { 211 fn convert_integer_with_underscores() {
212 let before = "const _: i32 = 1_00_0<|>;"; 212 let before = "const _: i32 = 1_00_0$0;";
213 213
214 check_assist_by_label( 214 check_assist_by_label(
215 convert_integer_literal, 215 convert_integer_literal,
@@ -235,7 +235,7 @@ mod tests {
235 235
236 #[test] 236 #[test]
237 fn convert_integer_with_suffix() { 237 fn convert_integer_with_suffix() {
238 let before = "const _: i32 = 1000i32<|>;"; 238 let before = "const _: i32 = 1000i32$0;";
239 239
240 check_assist_by_label( 240 check_assist_by_label(
241 convert_integer_literal, 241 convert_integer_literal,
@@ -262,7 +262,7 @@ mod tests {
262 #[test] 262 #[test]
263 fn convert_overflowing_literal() { 263 fn convert_overflowing_literal() {
264 let before = "const _: i32 = 264 let before = "const _: i32 =
265 111111111111111111111111111111111111111111111111111111111111111111111111<|>;"; 265 111111111111111111111111111111111111111111111111111111111111111111111111$0;";
266 check_assist_not_applicable(convert_integer_literal, before); 266 check_assist_not_applicable(convert_integer_literal, before);
267 } 267 }
268} 268}
diff --git a/crates/assists/src/handlers/early_return.rs b/crates/assists/src/handlers/early_return.rs
index 7bcc318a9..8bbbb7ed5 100644
--- a/crates/assists/src/handlers/early_return.rs
+++ b/crates/assists/src/handlers/early_return.rs
@@ -24,7 +24,7 @@ use crate::{
24// 24//
25// ``` 25// ```
26// fn main() { 26// fn main() {
27// <|>if cond { 27// $0if cond {
28// foo(); 28// foo();
29// bar(); 29// bar();
30// } 30// }
@@ -69,7 +69,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
69 69
70 let parent_block = if_expr.syntax().parent()?.ancestors().find_map(ast::BlockExpr::cast)?; 70 let parent_block = if_expr.syntax().parent()?.ancestors().find_map(ast::BlockExpr::cast)?;
71 71
72 if parent_block.expr()? != if_expr.clone().into() { 72 if parent_block.tail_expr()? != if_expr.clone().into() {
73 return None; 73 return None;
74 } 74 }
75 75
@@ -200,7 +200,7 @@ mod tests {
200 r#" 200 r#"
201 fn main() { 201 fn main() {
202 bar(); 202 bar();
203 if<|> true { 203 if$0 true {
204 foo(); 204 foo();
205 205
206 //comment 206 //comment
@@ -230,7 +230,7 @@ mod tests {
230 r#" 230 r#"
231 fn main(n: Option<String>) { 231 fn main(n: Option<String>) {
232 bar(); 232 bar();
233 if<|> let Some(n) = n { 233 if$0 let Some(n) = n {
234 foo(n); 234 foo(n);
235 235
236 //comment 236 //comment
@@ -260,7 +260,7 @@ mod tests {
260 convert_to_guarded_return, 260 convert_to_guarded_return,
261 r#" 261 r#"
262 fn main() { 262 fn main() {
263 if<|> let Ok(x) = Err(92) { 263 if$0 let Ok(x) = Err(92) {
264 foo(x); 264 foo(x);
265 } 265 }
266 } 266 }
@@ -284,7 +284,7 @@ mod tests {
284 r#" 284 r#"
285 fn main(n: Option<String>) { 285 fn main(n: Option<String>) {
286 bar(); 286 bar();
287 if<|> let Ok(n) = n { 287 if$0 let Ok(n) = n {
288 foo(n); 288 foo(n);
289 289
290 //comment 290 //comment
@@ -315,7 +315,7 @@ mod tests {
315 r#" 315 r#"
316 fn main() { 316 fn main() {
317 while true { 317 while true {
318 if<|> true { 318 if$0 true {
319 foo(); 319 foo();
320 bar(); 320 bar();
321 } 321 }
@@ -343,7 +343,7 @@ mod tests {
343 r#" 343 r#"
344 fn main() { 344 fn main() {
345 while true { 345 while true {
346 if<|> let Some(n) = n { 346 if$0 let Some(n) = n {
347 foo(n); 347 foo(n);
348 bar(); 348 bar();
349 } 349 }
@@ -372,7 +372,7 @@ mod tests {
372 r#" 372 r#"
373 fn main() { 373 fn main() {
374 loop { 374 loop {
375 if<|> true { 375 if$0 true {
376 foo(); 376 foo();
377 bar(); 377 bar();
378 } 378 }
@@ -400,7 +400,7 @@ mod tests {
400 r#" 400 r#"
401 fn main() { 401 fn main() {
402 loop { 402 loop {
403 if<|> let Some(n) = n { 403 if$0 let Some(n) = n {
404 foo(n); 404 foo(n);
405 bar(); 405 bar();
406 } 406 }
@@ -428,7 +428,7 @@ mod tests {
428 convert_to_guarded_return, 428 convert_to_guarded_return,
429 r#" 429 r#"
430 fn main() { 430 fn main() {
431 if<|> true { 431 if$0 true {
432 return; 432 return;
433 } 433 }
434 } 434 }
@@ -443,7 +443,7 @@ mod tests {
443 r#" 443 r#"
444 fn main() { 444 fn main() {
445 loop { 445 loop {
446 if<|> true { 446 if$0 true {
447 continue; 447 continue;
448 } 448 }
449 } 449 }
@@ -458,7 +458,7 @@ mod tests {
458 convert_to_guarded_return, 458 convert_to_guarded_return,
459 r#" 459 r#"
460 fn main() { 460 fn main() {
461 if<|> true { 461 if$0 true {
462 return 462 return
463 } 463 }
464 } 464 }
@@ -472,7 +472,7 @@ mod tests {
472 convert_to_guarded_return, 472 convert_to_guarded_return,
473 r#" 473 r#"
474 fn main() { 474 fn main() {
475 if<|> true { 475 if$0 true {
476 foo(); 476 foo();
477 } else { 477 } else {
478 bar() 478 bar()
@@ -488,7 +488,7 @@ mod tests {
488 convert_to_guarded_return, 488 convert_to_guarded_return,
489 r#" 489 r#"
490 fn main() { 490 fn main() {
491 if<|> true { 491 if$0 true {
492 foo(); 492 foo();
493 } 493 }
494 bar(); 494 bar();
@@ -504,7 +504,7 @@ mod tests {
504 r#" 504 r#"
505 fn main() { 505 fn main() {
506 if false { 506 if false {
507 if<|> true { 507 if$0 true {
508 foo(); 508 foo();
509 } 509 }
510 } 510 }
diff --git a/crates/assists/src/handlers/expand_glob_import.rs b/crates/assists/src/handlers/expand_glob_import.rs
index f51a9a4ad..5fe617ba4 100644
--- a/crates/assists/src/handlers/expand_glob_import.rs
+++ b/crates/assists/src/handlers/expand_glob_import.rs
@@ -25,7 +25,7 @@ use crate::{
25// pub struct Baz; 25// pub struct Baz;
26// } 26// }
27// 27//
28// use foo::*<|>; 28// use foo::*$0;
29// 29//
30// fn qux(bar: Bar, baz: Baz) {} 30// fn qux(bar: Bar, baz: Baz) {}
31// ``` 31// ```
@@ -201,7 +201,7 @@ fn is_mod_visible_from(ctx: &AssistContext, module: Module, from: Module) -> boo
201// } 201// }
202// 202//
203// ↓ --------------- 203// ↓ ---------------
204// use foo::*<|>; 204// use foo::*$0;
205// use baz::Baz; 205// use baz::Baz;
206// ↑ --------------- 206// ↑ ---------------
207fn find_imported_defs(ctx: &AssistContext, star: SyntaxToken) -> Option<Vec<Def>> { 207fn find_imported_defs(ctx: &AssistContext, star: SyntaxToken) -> Option<Vec<Def>> {
@@ -303,7 +303,7 @@ mod foo {
303 pub fn f() {} 303 pub fn f() {}
304} 304}
305 305
306use foo::*<|>; 306use foo::*$0;
307 307
308fn qux(bar: Bar, baz: Baz) { 308fn qux(bar: Bar, baz: Baz) {
309 f(); 309 f();
@@ -340,7 +340,7 @@ mod foo {
340 pub fn f() {} 340 pub fn f() {}
341} 341}
342 342
343use foo::{*<|>, f}; 343use foo::{*$0, f};
344 344
345fn qux(bar: Bar, baz: Baz) { 345fn qux(bar: Bar, baz: Baz) {
346 f(); 346 f();
@@ -378,7 +378,7 @@ mod foo {
378} 378}
379 379
380use foo::Bar; 380use foo::Bar;
381use foo::{*<|>, f}; 381use foo::{*$0, f};
382 382
383fn qux(bar: Bar, baz: Baz) { 383fn qux(bar: Bar, baz: Baz) {
384 f(); 384 f();
@@ -422,7 +422,7 @@ mod foo {
422 } 422 }
423} 423}
424 424
425use foo::{bar::{*<|>, f}, baz::*}; 425use foo::{bar::{*$0, f}, baz::*};
426 426
427fn qux(bar: Bar, baz: Baz) { 427fn qux(bar: Bar, baz: Baz) {
428 f(); 428 f();
@@ -470,7 +470,7 @@ mod foo {
470 } 470 }
471} 471}
472 472
473use foo::{bar::{Bar, Baz, f}, baz::*<|>}; 473use foo::{bar::{Bar, Baz, f}, baz::*$0};
474 474
475fn qux(bar: Bar, baz: Baz) { 475fn qux(bar: Bar, baz: Baz) {
476 f(); 476 f();
@@ -529,7 +529,7 @@ mod foo {
529 529
530use foo::{ 530use foo::{
531 bar::{*, f}, 531 bar::{*, f},
532 baz::{g, qux::*<|>} 532 baz::{g, qux::*$0}
533}; 533};
534 534
535fn qux(bar: Bar, baz: Baz) { 535fn qux(bar: Bar, baz: Baz) {
@@ -605,7 +605,7 @@ mod foo {
605 605
606use foo::{ 606use foo::{
607 bar::{*, f}, 607 bar::{*, f},
608 baz::{g, qux::{h, q::*<|>}} 608 baz::{g, qux::{h, q::*$0}}
609}; 609};
610 610
611fn qux(bar: Bar, baz: Baz) { 611fn qux(bar: Bar, baz: Baz) {
@@ -681,7 +681,7 @@ mod foo {
681 681
682use foo::{ 682use foo::{
683 bar::{*, f}, 683 bar::{*, f},
684 baz::{g, qux::{q::j, *<|>}} 684 baz::{g, qux::{q::j, *$0}}
685}; 685};
686 686
687fn qux(bar: Bar, baz: Baz) { 687fn qux(bar: Bar, baz: Baz) {
@@ -747,7 +747,7 @@ fn qux(bar: Bar, baz: Baz) {
747 // pub fn baz() {} 747 // pub fn baz() {}
748 748
749 // //- /main.rs crate:main deps:foo 749 // //- /main.rs crate:main deps:foo
750 // use foo::*<|>; 750 // use foo::*$0;
751 751
752 // fn main() { 752 // fn main() {
753 // bar!(); 753 // bar!();
@@ -777,7 +777,7 @@ pub trait Tr {
777impl Tr for () {} 777impl Tr for () {}
778 778
779//- /main.rs crate:main deps:foo 779//- /main.rs crate:main deps:foo
780use foo::*<|>; 780use foo::*$0;
781 781
782fn main() { 782fn main() {
783 ().method(); 783 ().method();
@@ -807,7 +807,7 @@ pub trait Tr2 {
807impl Tr2 for () {} 807impl Tr2 for () {}
808 808
809//- /main.rs crate:main deps:foo 809//- /main.rs crate:main deps:foo
810use foo::*<|>; 810use foo::*$0;
811 811
812fn main() { 812fn main() {
813 ().method(); 813 ().method();
@@ -834,7 +834,7 @@ mod foo {
834 } 834 }
835} 835}
836 836
837use foo::bar::*<|>; 837use foo::bar::*$0;
838 838
839fn baz(bar: Bar) {} 839fn baz(bar: Bar) {}
840", 840",
@@ -851,7 +851,7 @@ mod foo {
851 } 851 }
852} 852}
853 853
854use foo::bar::baz::*<|>; 854use foo::bar::baz::*$0;
855 855
856fn qux(baz: Baz) {} 856fn qux(baz: Baz) {}
857", 857",
@@ -869,7 +869,7 @@ fn qux(baz: Baz) {}
869 pub struct Qux; 869 pub struct Qux;
870 } 870 }
871 871
872 use foo::Bar<|>; 872 use foo::Bar$0;
873 873
874 fn qux(bar: Bar, baz: Baz) {} 874 fn qux(bar: Bar, baz: Baz) {}
875 ", 875 ",
@@ -885,7 +885,7 @@ mod foo {
885 pub struct Bar; 885 pub struct Bar;
886} 886}
887 887
888use foo::{*<|>}; 888use foo::{*$0};
889 889
890struct Baz { 890struct Baz {
891 bar: Bar 891 bar: Bar
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
index 030b9cd0c..e3ef04932 100644
--- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -2,12 +2,16 @@ use std::iter;
2 2
3use either::Either; 3use either::Either;
4use hir::{AsName, Module, ModuleDef, Name, Variant}; 4use hir::{AsName, Module, ModuleDef, Name, Variant};
5use ide_db::helpers::{ 5use ide_db::{
6 insert_use::{insert_use, ImportScope}, 6 defs::Definition,
7 mod_path_to_ast, 7 helpers::{
8 insert_use::{insert_use, ImportScope},
9 mod_path_to_ast,
10 },
11 search::FileReference,
12 RootDatabase,
8}; 13};
9use ide_db::{defs::Definition, search::Reference, RootDatabase}; 14use rustc_hash::FxHashSet;
10use rustc_hash::{FxHashMap, FxHashSet};
11use syntax::{ 15use syntax::{
12 algo::{find_node_at_offset, SyntaxRewriter}, 16 algo::{find_node_at_offset, SyntaxRewriter},
13 ast::{self, edit::IndentLevel, make, AstNode, NameOwner, VisibilityOwner}, 17 ast::{self, edit::IndentLevel, make, AstNode, NameOwner, VisibilityOwner},
@@ -21,7 +25,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
21// Extracts a struct from enum variant. 25// Extracts a struct from enum variant.
22// 26//
23// ``` 27// ```
24// enum A { <|>One(u32, u32) } 28// enum A { $0One(u32, u32) }
25// ``` 29// ```
26// -> 30// ->
27// ``` 31// ```
@@ -58,29 +62,29 @@ pub(crate) fn extract_struct_from_enum_variant(
58 let mut visited_modules_set = FxHashSet::default(); 62 let mut visited_modules_set = FxHashSet::default();
59 let current_module = enum_hir.module(ctx.db()); 63 let current_module = enum_hir.module(ctx.db());
60 visited_modules_set.insert(current_module); 64 visited_modules_set.insert(current_module);
61 let mut rewriters = FxHashMap::default(); 65 let mut def_rewriter = None;
62 for reference in usages { 66 for (file_id, references) in usages {
63 let rewriter = rewriters 67 let mut rewriter = SyntaxRewriter::default();
64 .entry(reference.file_range.file_id) 68 let source_file = ctx.sema.parse(file_id);
65 .or_insert_with(SyntaxRewriter::default); 69 for reference in references {
66 let source_file = ctx.sema.parse(reference.file_range.file_id); 70 update_reference(
67 update_reference( 71 ctx,
68 ctx, 72 &mut rewriter,
69 rewriter, 73 reference,
70 reference, 74 &source_file,
71 &source_file, 75 &enum_module_def,
72 &enum_module_def, 76 &variant_hir_name,
73 &variant_hir_name, 77 &mut visited_modules_set,
74 &mut visited_modules_set, 78 );
75 ); 79 }
76 } 80 if file_id == ctx.frange.file_id {
77 let mut rewriter = 81 def_rewriter = Some(rewriter);
78 rewriters.remove(&ctx.frange.file_id).unwrap_or_else(SyntaxRewriter::default); 82 continue;
79 for (file_id, rewriter) in rewriters { 83 }
80 builder.edit_file(file_id); 84 builder.edit_file(file_id);
81 builder.rewrite(rewriter); 85 builder.rewrite(rewriter);
82 } 86 }
83 builder.edit_file(ctx.frange.file_id); 87 let mut rewriter = def_rewriter.unwrap_or_default();
84 update_variant(&mut rewriter, &variant); 88 update_variant(&mut rewriter, &variant);
85 extract_struct_def( 89 extract_struct_def(
86 &mut rewriter, 90 &mut rewriter,
@@ -90,6 +94,7 @@ pub(crate) fn extract_struct_from_enum_variant(
90 &variant.parent_enum().syntax().clone().into(), 94 &variant.parent_enum().syntax().clone().into(),
91 enum_ast.visibility(), 95 enum_ast.visibility(),
92 ); 96 );
97 builder.edit_file(ctx.frange.file_id);
93 builder.rewrite(rewriter); 98 builder.rewrite(rewriter);
94 }, 99 },
95 ) 100 )
@@ -117,10 +122,14 @@ fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Va
117 .into_iter() 122 .into_iter()
118 .filter(|(_, def)| match def { 123 .filter(|(_, def)| match def {
119 // only check type-namespace 124 // only check type-namespace
120 hir::ScopeDef::ModuleDef(def) => matches!(def, 125 hir::ScopeDef::ModuleDef(def) => matches!(
121 ModuleDef::Module(_) | ModuleDef::Adt(_) | 126 def,
122 ModuleDef::Variant(_) | ModuleDef::Trait(_) | 127 ModuleDef::Module(_)
123 ModuleDef::TypeAlias(_) | ModuleDef::BuiltinType(_) 128 | ModuleDef::Adt(_)
129 | ModuleDef::Variant(_)
130 | ModuleDef::Trait(_)
131 | ModuleDef::TypeAlias(_)
132 | ModuleDef::BuiltinType(_)
124 ), 133 ),
125 _ => false, 134 _ => false,
126 }) 135 })
@@ -201,13 +210,13 @@ fn update_variant(rewriter: &mut SyntaxRewriter, variant: &ast::Variant) -> Opti
201fn update_reference( 210fn update_reference(
202 ctx: &AssistContext, 211 ctx: &AssistContext,
203 rewriter: &mut SyntaxRewriter, 212 rewriter: &mut SyntaxRewriter,
204 reference: Reference, 213 reference: FileReference,
205 source_file: &SourceFile, 214 source_file: &SourceFile,
206 enum_module_def: &ModuleDef, 215 enum_module_def: &ModuleDef,
207 variant_hir_name: &Name, 216 variant_hir_name: &Name,
208 visited_modules_set: &mut FxHashSet<Module>, 217 visited_modules_set: &mut FxHashSet<Module>,
209) -> Option<()> { 218) -> Option<()> {
210 let offset = reference.file_range.range.start(); 219 let offset = reference.range.start();
211 let (segment, expr) = if let Some(path_expr) = 220 let (segment, expr) = if let Some(path_expr) =
212 find_node_at_offset::<ast::PathExpr>(source_file.syntax(), offset) 221 find_node_at_offset::<ast::PathExpr>(source_file.syntax(), offset)
213 { 222 {
@@ -247,7 +256,7 @@ mod tests {
247 fn test_extract_struct_several_fields_tuple() { 256 fn test_extract_struct_several_fields_tuple() {
248 check_assist( 257 check_assist(
249 extract_struct_from_enum_variant, 258 extract_struct_from_enum_variant,
250 "enum A { <|>One(u32, u32) }", 259 "enum A { $0One(u32, u32) }",
251 r#"struct One(pub u32, pub u32); 260 r#"struct One(pub u32, pub u32);
252 261
253enum A { One(One) }"#, 262enum A { One(One) }"#,
@@ -258,7 +267,7 @@ enum A { One(One) }"#,
258 fn test_extract_struct_several_fields_named() { 267 fn test_extract_struct_several_fields_named() {
259 check_assist( 268 check_assist(
260 extract_struct_from_enum_variant, 269 extract_struct_from_enum_variant,
261 "enum A { <|>One { foo: u32, bar: u32 } }", 270 "enum A { $0One { foo: u32, bar: u32 } }",
262 r#"struct One{ pub foo: u32, pub bar: u32 } 271 r#"struct One{ pub foo: u32, pub bar: u32 }
263 272
264enum A { One(One) }"#, 273enum A { One(One) }"#,
@@ -269,7 +278,7 @@ enum A { One(One) }"#,
269 fn test_extract_struct_one_field_named() { 278 fn test_extract_struct_one_field_named() {
270 check_assist( 279 check_assist(
271 extract_struct_from_enum_variant, 280 extract_struct_from_enum_variant,
272 "enum A { <|>One { foo: u32 } }", 281 "enum A { $0One { foo: u32 } }",
273 r#"struct One{ pub foo: u32 } 282 r#"struct One{ pub foo: u32 }
274 283
275enum A { One(One) }"#, 284enum A { One(One) }"#,
@@ -281,7 +290,7 @@ enum A { One(One) }"#,
281 check_assist( 290 check_assist(
282 extract_struct_from_enum_variant, 291 extract_struct_from_enum_variant,
283 r#"const One: () = (); 292 r#"const One: () = ();
284enum A { <|>One(u32, u32) }"#, 293enum A { $0One(u32, u32) }"#,
285 r#"const One: () = (); 294 r#"const One: () = ();
286struct One(pub u32, pub u32); 295struct One(pub u32, pub u32);
287 296
@@ -293,7 +302,7 @@ enum A { One(One) }"#,
293 fn test_extract_struct_pub_visibility() { 302 fn test_extract_struct_pub_visibility() {
294 check_assist( 303 check_assist(
295 extract_struct_from_enum_variant, 304 extract_struct_from_enum_variant,
296 "pub enum A { <|>One(u32, u32) }", 305 "pub enum A { $0One(u32, u32) }",
297 r#"pub struct One(pub u32, pub u32); 306 r#"pub struct One(pub u32, pub u32);
298 307
299pub enum A { One(One) }"#, 308pub enum A { One(One) }"#,
@@ -315,7 +324,7 @@ pub enum A { One(One) }"#,
315 } 324 }
316 325
317 pub enum MyEnum { 326 pub enum MyEnum {
318 <|>MyField(u8, u8), 327 $0MyField(u8, u8),
319 } 328 }
320 } 329 }
321} 330}
@@ -357,7 +366,7 @@ fn another_fn() {
357 extract_struct_from_enum_variant, 366 extract_struct_from_enum_variant,
358 r#" 367 r#"
359enum E { 368enum E {
360 <|>V { i: i32, j: i32 } 369 $0V { i: i32, j: i32 }
361} 370}
362 371
363fn f() { 372fn f() {
@@ -385,7 +394,7 @@ fn f() {
385 r#" 394 r#"
386//- /main.rs 395//- /main.rs
387enum E { 396enum E {
388 <|>V(i32, i32) 397 $0V(i32, i32)
389} 398}
390mod foo; 399mod foo;
391 400
@@ -420,7 +429,7 @@ fn f() {
420 r#" 429 r#"
421//- /main.rs 430//- /main.rs
422enum E { 431enum E {
423 <|>V { i: i32, j: i32 } 432 $0V { i: i32, j: i32 }
424} 433}
425mod foo; 434mod foo;
426 435
@@ -453,7 +462,7 @@ fn f() {
453 check_assist( 462 check_assist(
454 extract_struct_from_enum_variant, 463 extract_struct_from_enum_variant,
455 r#" 464 r#"
456enum A { <|>One { a: u32, b: u32 } } 465enum A { $0One { a: u32, b: u32 } }
457 466
458struct B(A); 467struct B(A);
459 468
@@ -483,29 +492,29 @@ fn foo() {
483 492
484 #[test] 493 #[test]
485 fn test_extract_enum_not_applicable_for_element_with_no_fields() { 494 fn test_extract_enum_not_applicable_for_element_with_no_fields() {
486 check_not_applicable("enum A { <|>One }"); 495 check_not_applicable("enum A { $0One }");
487 } 496 }
488 497
489 #[test] 498 #[test]
490 fn test_extract_enum_not_applicable_if_struct_exists() { 499 fn test_extract_enum_not_applicable_if_struct_exists() {
491 check_not_applicable( 500 check_not_applicable(
492 r#"struct One; 501 r#"struct One;
493 enum A { <|>One(u8, u32) }"#, 502 enum A { $0One(u8, u32) }"#,
494 ); 503 );
495 } 504 }
496 505
497 #[test] 506 #[test]
498 fn test_extract_not_applicable_one_field() { 507 fn test_extract_not_applicable_one_field() {
499 check_not_applicable(r"enum A { <|>One(u32) }"); 508 check_not_applicable(r"enum A { $0One(u32) }");
500 } 509 }
501 510
502 #[test] 511 #[test]
503 fn test_extract_not_applicable_no_field_tuple() { 512 fn test_extract_not_applicable_no_field_tuple() {
504 check_not_applicable(r"enum A { <|>None() }"); 513 check_not_applicable(r"enum A { $0None() }");
505 } 514 }
506 515
507 #[test] 516 #[test]
508 fn test_extract_not_applicable_no_field_named() { 517 fn test_extract_not_applicable_no_field_named() {
509 check_not_applicable(r"enum A { <|>None {} }"); 518 check_not_applicable(r"enum A { $0None {} }");
510 } 519 }
511} 520}
diff --git a/crates/assists/src/handlers/extract_variable.rs b/crates/assists/src/handlers/extract_variable.rs
index 9957012fe..98f3dc6ca 100644
--- a/crates/assists/src/handlers/extract_variable.rs
+++ b/crates/assists/src/handlers/extract_variable.rs
@@ -16,7 +16,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
16// 16//
17// ``` 17// ```
18// fn main() { 18// fn main() {
19// <|>(1 + 2)<|> * 4; 19// $0(1 + 2)$0 * 4;
20// } 20// }
21// ``` 21// ```
22// -> 22// ->
@@ -139,7 +139,7 @@ impl Anchor {
139 fn from(to_extract: &ast::Expr) -> Option<Anchor> { 139 fn from(to_extract: &ast::Expr) -> Option<Anchor> {
140 to_extract.syntax().ancestors().find_map(|node| { 140 to_extract.syntax().ancestors().find_map(|node| {
141 if let Some(expr) = 141 if let Some(expr) =
142 node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.expr()) 142 node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.tail_expr())
143 { 143 {
144 if expr.syntax() == &node { 144 if expr.syntax() == &node {
145 mark::hit!(test_extract_var_last_expr); 145 mark::hit!(test_extract_var_last_expr);
@@ -187,7 +187,7 @@ mod tests {
187 extract_variable, 187 extract_variable,
188 r#" 188 r#"
189fn foo() { 189fn foo() {
190 foo(<|>1 + 1<|>); 190 foo($01 + 1$0);
191}"#, 191}"#,
192 r#" 192 r#"
193fn foo() { 193fn foo() {
@@ -200,7 +200,7 @@ fn foo() {
200 #[test] 200 #[test]
201 fn extract_var_in_comment_is_not_applicable() { 201 fn extract_var_in_comment_is_not_applicable() {
202 mark::check!(extract_var_in_comment_is_not_applicable); 202 mark::check!(extract_var_in_comment_is_not_applicable);
203 check_assist_not_applicable(extract_variable, "fn main() { 1 + /* <|>comment<|> */ 1; }"); 203 check_assist_not_applicable(extract_variable, "fn main() { 1 + /* $0comment$0 */ 1; }");
204 } 204 }
205 205
206 #[test] 206 #[test]
@@ -210,7 +210,7 @@ fn foo() {
210 extract_variable, 210 extract_variable,
211 r#" 211 r#"
212fn foo() { 212fn foo() {
213 <|>1 + 1<|>; 213 $01 + 1$0;
214}"#, 214}"#,
215 r#" 215 r#"
216fn foo() { 216fn foo() {
@@ -221,7 +221,7 @@ fn foo() {
221 extract_variable, 221 extract_variable,
222 " 222 "
223fn foo() { 223fn foo() {
224 <|>{ let x = 0; x }<|> 224 $0{ let x = 0; x }$0
225 something_else(); 225 something_else();
226}", 226}",
227 " 227 "
@@ -238,7 +238,7 @@ fn foo() {
238 extract_variable, 238 extract_variable,
239 " 239 "
240fn foo() { 240fn foo() {
241 <|>1<|> + 1; 241 $01$0 + 1;
242}", 242}",
243 " 243 "
244fn foo() { 244fn foo() {
@@ -255,7 +255,7 @@ fn foo() {
255 extract_variable, 255 extract_variable,
256 r#" 256 r#"
257fn foo() { 257fn foo() {
258 bar(<|>1 + 1<|>) 258 bar($01 + 1$0)
259} 259}
260"#, 260"#,
261 r#" 261 r#"
@@ -269,7 +269,7 @@ fn foo() {
269 extract_variable, 269 extract_variable,
270 r#" 270 r#"
271fn foo() { 271fn foo() {
272 <|>bar(1 + 1)<|> 272 $0bar(1 + 1)$0
273} 273}
274"#, 274"#,
275 r#" 275 r#"
@@ -289,7 +289,7 @@ fn foo() {
289fn main() { 289fn main() {
290 let x = true; 290 let x = true;
291 let tuple = match x { 291 let tuple = match x {
292 true => (<|>2 + 2<|>, true) 292 true => ($02 + 2$0, true)
293 _ => (0, false) 293 _ => (0, false)
294 }; 294 };
295} 295}
@@ -316,7 +316,7 @@ fn main() {
316 let tuple = match x { 316 let tuple = match x {
317 true => { 317 true => {
318 let y = 1; 318 let y = 1;
319 (<|>2 + y<|>, true) 319 ($02 + y$0, true)
320 } 320 }
321 _ => (0, false) 321 _ => (0, false)
322 }; 322 };
@@ -344,7 +344,7 @@ fn main() {
344 extract_variable, 344 extract_variable,
345 " 345 "
346fn main() { 346fn main() {
347 let lambda = |x: u32| <|>x * 2<|>; 347 let lambda = |x: u32| $0x * 2$0;
348} 348}
349", 349",
350 " 350 "
@@ -361,7 +361,7 @@ fn main() {
361 extract_variable, 361 extract_variable,
362 " 362 "
363fn main() { 363fn main() {
364 let lambda = |x: u32| { <|>x * 2<|> }; 364 let lambda = |x: u32| { $0x * 2$0 };
365} 365}
366", 366",
367 " 367 "
@@ -378,7 +378,7 @@ fn main() {
378 extract_variable, 378 extract_variable,
379 " 379 "
380fn main() { 380fn main() {
381 let o = <|>Some(true)<|>; 381 let o = $0Some(true)$0;
382} 382}
383", 383",
384 " 384 "
@@ -396,7 +396,7 @@ fn main() {
396 extract_variable, 396 extract_variable,
397 " 397 "
398fn main() { 398fn main() {
399 let v = <|>bar.foo()<|>; 399 let v = $0bar.foo()$0;
400} 400}
401", 401",
402 " 402 "
@@ -414,7 +414,7 @@ fn main() {
414 extract_variable, 414 extract_variable,
415 " 415 "
416fn foo() -> u32 { 416fn foo() -> u32 {
417 <|>return 2 + 2<|>; 417 $0return 2 + 2$0;
418} 418}
419", 419",
420 " 420 "
@@ -434,7 +434,7 @@ fn foo() -> u32 {
434fn foo() -> u32 { 434fn foo() -> u32 {
435 435
436 436
437 <|>return 2 + 2<|>; 437 $0return 2 + 2$0;
438} 438}
439", 439",
440 " 440 "
@@ -452,7 +452,7 @@ fn foo() -> u32 {
452 " 452 "
453fn foo() -> u32 { 453fn foo() -> u32 {
454 454
455 <|>return 2 + 2<|>; 455 $0return 2 + 2$0;
456} 456}
457", 457",
458 " 458 "
@@ -473,7 +473,7 @@ fn foo() -> u32 {
473 // bar 473 // bar
474 474
475 475
476 <|>return 2 + 2<|>; 476 $0return 2 + 2$0;
477} 477}
478", 478",
479 " 479 "
@@ -497,7 +497,7 @@ fn foo() -> u32 {
497 " 497 "
498fn main() { 498fn main() {
499 let result = loop { 499 let result = loop {
500 <|>break 2 + 2<|>; 500 $0break 2 + 2$0;
501 }; 501 };
502} 502}
503", 503",
@@ -518,7 +518,7 @@ fn main() {
518 extract_variable, 518 extract_variable,
519 " 519 "
520fn main() { 520fn main() {
521 let v = <|>0f32 as u32<|>; 521 let v = $00f32 as u32$0;
522} 522}
523", 523",
524 " 524 "
@@ -540,7 +540,7 @@ struct S {
540} 540}
541 541
542fn main() { 542fn main() {
543 S { foo: <|>1 + 1<|> } 543 S { foo: $01 + 1$0 }
544} 544}
545"#, 545"#,
546 r#" 546 r#"
@@ -558,18 +558,18 @@ fn main() {
558 558
559 #[test] 559 #[test]
560 fn test_extract_var_for_return_not_applicable() { 560 fn test_extract_var_for_return_not_applicable() {
561 check_assist_not_applicable(extract_variable, "fn foo() { <|>return<|>; } "); 561 check_assist_not_applicable(extract_variable, "fn foo() { $0return$0; } ");
562 } 562 }
563 563
564 #[test] 564 #[test]
565 fn test_extract_var_for_break_not_applicable() { 565 fn test_extract_var_for_break_not_applicable() {
566 check_assist_not_applicable(extract_variable, "fn main() { loop { <|>break<|>; }; }"); 566 check_assist_not_applicable(extract_variable, "fn main() { loop { $0break$0; }; }");
567 } 567 }
568 568
569 // FIXME: This is not quite correct, but good enough(tm) for the sorting heuristic 569 // FIXME: This is not quite correct, but good enough(tm) for the sorting heuristic
570 #[test] 570 #[test]
571 fn extract_var_target() { 571 fn extract_var_target() {
572 check_assist_target(extract_variable, "fn foo() -> u32 { <|>return 2 + 2<|>; }", "2 + 2"); 572 check_assist_target(extract_variable, "fn foo() -> u32 { $0return 2 + 2$0; }", "2 + 2");
573 573
574 check_assist_target( 574 check_assist_target(
575 extract_variable, 575 extract_variable,
@@ -577,7 +577,7 @@ fn main() {
577fn main() { 577fn main() {
578 let x = true; 578 let x = true;
579 let tuple = match x { 579 let tuple = match x {
580 true => (<|>2 + 2<|>, true) 580 true => ($02 + 2$0, true)
581 _ => (0, false) 581 _ => (0, false)
582 }; 582 };
583} 583}
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs
index cb60a3128..da47187e4 100644
--- a/crates/assists/src/handlers/fill_match_arms.rs
+++ b/crates/assists/src/handlers/fill_match_arms.rs
@@ -21,7 +21,7 @@ use crate::{
21// 21//
22// fn handle(action: Action) { 22// fn handle(action: Action) {
23// match action { 23// match action {
24// <|> 24// $0
25// } 25// }
26// } 26// }
27// ``` 27// ```
@@ -196,7 +196,7 @@ fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::Variant) -> Optio
196 let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?); 196 let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?);
197 197
198 // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though 198 // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though
199 let pat: ast::Pat = match var.source(db).value.kind() { 199 let pat: ast::Pat = match var.source(db)?.value.kind() {
200 ast::StructKind::Tuple(field_list) => { 200 ast::StructKind::Tuple(field_list) => {
201 let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count()); 201 let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count());
202 make::tuple_struct_pat(path, pats).into() 202 make::tuple_struct_pat(path, pats).into()
@@ -231,7 +231,7 @@ mod tests {
231 Cs(i32, Option<i32>), 231 Cs(i32, Option<i32>),
232 } 232 }
233 fn main() { 233 fn main() {
234 match A::As<|> { 234 match A::As$0 {
235 A::As, 235 A::As,
236 A::Bs{x,y:Some(_)} => {} 236 A::Bs{x,y:Some(_)} => {}
237 A::Cs(_, Some(_)) => {} 237 A::Cs(_, Some(_)) => {}
@@ -249,7 +249,7 @@ mod tests {
249 fill_match_arms, 249 fill_match_arms,
250 r#" 250 r#"
251 fn main() { 251 fn main() {
252 match (0, false)<|> { 252 match (0, false)$0 {
253 } 253 }
254 } 254 }
255 "#, 255 "#,
@@ -267,7 +267,7 @@ mod tests {
267 Cs(i32, Option<i32>), 267 Cs(i32, Option<i32>),
268 } 268 }
269 fn main() { 269 fn main() {
270 match A::As<|> { 270 match A::As$0 {
271 A::Bs { x, y: Some(_) } => {} 271 A::Bs { x, y: Some(_) } => {}
272 A::Cs(_, Some(_)) => {} 272 A::Cs(_, Some(_)) => {}
273 } 273 }
@@ -297,7 +297,7 @@ mod tests {
297 r#" 297 r#"
298enum A { As, Bs, Cs(Option<i32>) } 298enum A { As, Bs, Cs(Option<i32>) }
299fn main() { 299fn main() {
300 match A::As<|> { 300 match A::As$0 {
301 A::Cs(_) | A::Bs => {} 301 A::Cs(_) | A::Bs => {}
302 } 302 }
303} 303}
@@ -322,7 +322,7 @@ fn main() {
322enum A { As, Bs, Cs, Ds(String), Es(B) } 322enum A { As, Bs, Cs, Ds(String), Es(B) }
323enum B { Xs, Ys } 323enum B { Xs, Ys }
324fn main() { 324fn main() {
325 match A::As<|> { 325 match A::As$0 {
326 A::Bs if 0 < 1 => {} 326 A::Bs if 0 < 1 => {}
327 A::Ds(_value) => { let x = 1; } 327 A::Ds(_value) => { let x = 1; }
328 A::Es(B::Xs) => (), 328 A::Es(B::Xs) => (),
@@ -352,7 +352,7 @@ fn main() {
352 r#" 352 r#"
353enum A { As, Bs, Cs(Option<i32>) } 353enum A { As, Bs, Cs(Option<i32>) }
354fn main() { 354fn main() {
355 match A::As<|> { 355 match A::As$0 {
356 A::As(_) => {} 356 A::As(_) => {}
357 a @ A::Bs(_) => {} 357 a @ A::Bs(_) => {}
358 } 358 }
@@ -380,7 +380,7 @@ enum A { As, Bs, Cs(String), Ds(String, String), Es { x: usize, y: usize } }
380 380
381fn main() { 381fn main() {
382 let a = A::As; 382 let a = A::As;
383 match a<|> {} 383 match a$0 {}
384} 384}
385"#, 385"#,
386 r#" 386 r#"
@@ -411,7 +411,7 @@ fn main() {
411 fn main() { 411 fn main() {
412 let a = A::One; 412 let a = A::One;
413 let b = B::One; 413 let b = B::One;
414 match (a<|>, b) {} 414 match (a$0, b) {}
415 } 415 }
416 "#, 416 "#,
417 r#" 417 r#"
@@ -443,7 +443,7 @@ fn main() {
443 fn main() { 443 fn main() {
444 let a = A::One; 444 let a = A::One;
445 let b = B::One; 445 let b = B::One;
446 match (&a<|>, &b) {} 446 match (&a$0, &b) {}
447 } 447 }
448 "#, 448 "#,
449 r#" 449 r#"
@@ -475,7 +475,7 @@ fn main() {
475 fn main() { 475 fn main() {
476 let a = A::One; 476 let a = A::One;
477 let b = B::One; 477 let b = B::One;
478 match (a<|>, b) { 478 match (a$0, b) {
479 (A::Two, B::One) => {} 479 (A::Two, B::One) => {}
480 } 480 }
481 } 481 }
@@ -494,7 +494,7 @@ fn main() {
494 fn main() { 494 fn main() {
495 let a = A::One; 495 let a = A::One;
496 let b = B::One; 496 let b = B::One;
497 match (a<|>, b) { 497 match (a$0, b) {
498 (A::Two, B::One) => {} 498 (A::Two, B::One) => {}
499 (A::One, B::One) => {} 499 (A::One, B::One) => {}
500 (A::One, B::Two) => {} 500 (A::One, B::Two) => {}
@@ -517,7 +517,7 @@ fn main() {
517 517
518 fn main() { 518 fn main() {
519 let a = A::One; 519 let a = A::One;
520 match (a<|>, ) { 520 match (a$0, ) {
521 } 521 }
522 } 522 }
523 "#, 523 "#,
@@ -532,7 +532,7 @@ fn main() {
532 enum A { As } 532 enum A { As }
533 533
534 fn foo(a: &A) { 534 fn foo(a: &A) {
535 match a<|> { 535 match a$0 {
536 } 536 }
537 } 537 }
538 "#, 538 "#,
@@ -555,7 +555,7 @@ fn main() {
555 } 555 }
556 556
557 fn foo(a: &mut A) { 557 fn foo(a: &mut A) {
558 match a<|> { 558 match a$0 {
559 } 559 }
560 } 560 }
561 "#, 561 "#,
@@ -581,7 +581,7 @@ fn main() {
581 enum E { X, Y } 581 enum E { X, Y }
582 582
583 fn main() { 583 fn main() {
584 match E::X<|> {} 584 match E::X$0 {}
585 } 585 }
586 "#, 586 "#,
587 "match E::X {}", 587 "match E::X {}",
@@ -597,7 +597,7 @@ fn main() {
597 597
598 fn main() { 598 fn main() {
599 match E::X { 599 match E::X {
600 <|>_ => {} 600 $0_ => {}
601 }