Skip to content

Commit

Permalink
Use document buffer
Browse files Browse the repository at this point in the history
An ITextView can have multiple ITextBuffer instances associated with it.
When looking for the main ITextDocument associated with an ITextView it
should always be done through the DocumentBuffer.  The previous code was
using ITextView::TextBuffer which is equivalent to the EditBuffer.

The reason this worked in standard files (like a .cs) is that the
EditBuffer and DocumentBuffer are the same value.  In razor files the
view is much more complex and the EditBuffer is actually a rather
complicated projection buffer (instance of IProjectionBuffer).  Hence it
had no associated document.

closes #21
  • Loading branch information
jaredpar committed Jul 24, 2014
1 parent 37f48e5 commit 54990e6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class EncourageIntellisenseControllerProvider : IIntellisenseController
public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList<ITextBuffer> subjectBuffers)
{
ITextDocument textDocument;
if (!TextDocumentFactoryService.TryGetTextDocument(textView.TextBuffer, out textDocument))
if (!TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out textDocument))
{
return null;
}
Expand Down

0 comments on commit 54990e6

Please sign in to comment.