5

Remove type alias definition on inline by ice1000 · Pull Request #13091 · rust-l...

 2 years ago
source link: https://github.com/rust-lang/rust-analyzer/pull/13091
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Remove type alias definition on inline #13091

Merged

bors merged 7 commits into

rust-lang:master

from

ice1k:hey

3 days ago

Conversation

Contributor

@ice1000 ice1000 commented 17 days ago

Fix #13079

All reactions

Contributor

Author

ice1000 commented 16 days ago

I'm having trouble implementing the removal of use statements. With the latest code I get very weird indels generated by code that I don't know where they are -- I failed to setup lldb (breakpoints never hit), and backtrace library is unstable so I can't use it either.

Rust debugging is too difficult for me. I'm requesting help!

Contributor

Author

ice1000 commented 13 days ago

/cc @Veykril

Contributor

Author

ice1000 commented 10 days ago

Still fails. The stack traces look like

   3: text_edit::assert_disjoint_or_equal
   4: text_edit::TextEditBuilder::indel
   5: text_edit::TextEditBuilder::delete
   6: syntax::algo::TreeDiff::into_text_edit
   7: ide_db::source_change::SourceChangeBuilder::commit
   8: ide_db::source_change::SourceChangeBuilder::finish
   9: ide_assists::assist_context::Assists::add_impl
  10: ide_assists::assist_context::Assists::add
  11: ide_assists::handlers::inline_type_alias::inline_type_alias_uses

I'm unsure why is that happening

Member

Veykril commented 8 days ago

I believe the problem you are running into is that you are split_refs_and_uses + remove_path_if_in_use_stmt does removal via mutable syntax nodes, this creates a diff of the tree that then gets applied as text edits, this diff in this case is very disruptive and overlaps with your manual replace calls causing the panic. In general mixing these two APIs (manual replace, delete etc calls on builder with text ranges and using mutable syntax nodes) does not work out well.

ice1000 reacted with thumbs up emoji All reactions

Contributor

Author

ice1000 commented 7 days ago

@Veykril is it possible to use ted::replace to replace a tree node with an unparsed text? (which is the return value of to_text here)

ice1000

marked this pull request as ready for review

7 days ago

Contributor

Author

ice1000 commented 7 days ago

@Veykril I'm done! :)

Contributor

Author

ice1000 commented 4 days ago

ping @Veykril

Veykril

self-assigned this

4 days ago

Member

Veykril commented 3 days ago

@bors r+

Collaborator

bors commented 3 days ago

pushpin Commit 364d9c4 has been approved by Veykril

It is now in the queue for this repository.

Collaborator

bors commented 3 days ago

hourglass Testing commit 364d9c4 with merge a1c2653...

Collaborator

bors commented 3 days ago

sunny Test successful - checks-actions
Approved by: Veykril
Pushing a1c2653 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Veykril

Assignees

Veykril

Labels
None yet
Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK