Skip to content

onDidOpenTextDocument is triggered multiple times when renaming a symbol with preview #196350

@gabrielBusuioc

Description

@gabrielBusuioc

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.83.1
  • OS Version: Ubuntu 22.04.2 LTS

Steps to Reproduce:

  1. Rename a symbol (that changes multiple files) with preview
    => An onDidOpenTextDocument event is emitted for every file involved in the renaming operation
    => Whenever I select a file from the Refactor Preview onDidOpenTextDocument is emitted twice (I assume because of the diff editor?)
    It also seems that some of the onDidOpenTextDocument events are followed by their corresponding onDidCloseTextDocument events, although this is not always the case.

I have a few issues/questions regarding this:

  • all of the onDidOpenTextDocument/didOpens will be completed even though their corresponding onDidCloseTextDocument/didClose was emitted (making that didOpen obsolete). This means that, when a rename symbol affects a lot of files, there will be a visible slowdown due to the time it takes to complete all of the didOpens.

  • I think it might be useful to know the actual context of an onDidOpenTextDocument event that was emitted. Was it emitted because of the Refactoring Preview view, or was it because the user manually opened a file? Can this be achieved / considered for future implementations?

  • Why are there so many onDidOpenTextDocument events emitted in the first place? Do I actually need to take them into consideration, just like I would for a "normal" didOpen? (It looks like I don`t ...)

Thanks!

Metadata

Metadata

Assignees

Labels

*questionIssue represents a question, should be posted to StackOverflow (VS Code)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions