Skip to content

Inline Rename breaks if any open document has text unavailable #30

@SLaks

Description

@SLaks

InlineRenameSession.InitializeOpenBuffers calls document.TryGetText instead of GetTextAsync.

If the DocumentState's textSource is a RecoverableTextAndVersion rather than a constant source, this won't return a text and will break the rename.

Typing into a document sets the text to a constant version, so this doesn't usually happen.

It consistently happens for me in a TextView with both C# and VB buffers from the same workspace (eg, my Markdown editor); unless all open Roslyn buffers either have had keystrokes or have the cursor (which triggers UpdateText fromGetOpenDocumentInCurrentContextWithChanges), it will fail in that method.

As an aside, I can't get rename to work anyway within VS; I need a Host workspace for IDocumentNavigationService (internal) to allow the rename, but I need a non-Host or the VS version of ITextUndoHistoryWorkspaceService will refuse to operate at all with my custom workspace class.
Ironically, rename works fine in custom hosts outside VS (VSEmbed), because I can skip the VS.LangServices layer entirely, except for IDocumentNavigationService to allow the rename

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions