Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix snippetTextEdits applying to other files #5480

Merged
merged 1 commit into from
Jul 23, 2020

Conversation

TimoFreiberg
Copy link
Contributor

@TimoFreiberg TimoFreiberg commented Jul 21, 2020

Fixes #4551
vscode.window.visibleTextEditors only contains editors whose contents are being displayed at the moment, so the previous logic only worked if the other file for which a snippetTextEdit is being received was visible in a separate split.

I feel that this is a hacky approach, so feel free to reject it for something nicer :)

@matklad
Copy link
Member

matklad commented Jul 22, 2020

Yeah, I think this is how it should be done. The whole thing is a hack basically :)

r=me with styl fixed. We also need to rememebr to port this to https://github.com/rust-lang/vscode-rust

@TimoFreiberg TimoFreiberg force-pushed the edit_different_file_fix branch from bfa1bbf to 1b5a74e Compare July 22, 2020 15:36
vscode.window.visibleTextEditors only contains editors whose contents
are being displayed at the moment, so the previous logic only worked if
the other file for which a snippetTextEdit is being received was visible
in a separate split.
TimoFreiberg added a commit to TimoFreiberg/vscode-rust that referenced this pull request Jul 22, 2020
vscode.window.visibleTextEditors only contains editors whose contents
are being displayed at the moment, so the previous logic only worked if
the other file for which a snippetTextEdit is being received was visible
in a separate split.

Ported from rust-analyzer: rust-lang/rust-analyzer#5480
@matklad
Copy link
Member

matklad commented Jul 23, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 23, 2020

@bors bors bot merged commit 85532e2 into rust-lang:master Jul 23, 2020
@kjeremy
Copy link
Contributor

kjeremy commented Jul 23, 2020

Out of curiosity isn't a WorkspaceEdit supposed to handle this without a file being opened in the editor?

@matklad
Copy link
Member

matklad commented Jul 23, 2020

Yeah, I thought about this, but, for assists, I think we actually always want to unconditionally open the file.

@TimoFreiberg TimoFreiberg deleted the edit_different_file_fix branch July 23, 2020 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generating a function in another module doesn't work
3 participants