ScriptEditorService.TextDocumentDidClose doesn't work well with SignalBehavior.Deferred

Currently, using ScriptEditorService.TextDocumentDidClose in a Plugin is unfortunately not possible when Workspace has SignalBehavior.Deferred selected. When this property is set in this way, the document will enter its “Closed” state before the event function is called, making it impossible to extract any meaningful data from the document.

Expected behavior

I expect the ScriptDocument to remain open for at least a small frame of time, while I still have the option to operate on the document as needed; regardless of the selected SignalBehavior Enum.

2 Likes

Thank you for the bug report. You’re correct that this is an oversight with this API in deferred signals mode. We will investigate and prepare a fix to allow a signal handler in TextDocumentDidClose to gather information about a closed document.

1 Like