File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/Tools/ExternalAccess/Razor Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+ // See the LICENSE file in the project root for more information.
4+
5+ using System . Diagnostics . CodeAnalysis ;
6+ using Microsoft . CodeAnalysis . Text ;
7+ using Microsoft . VisualStudio . Text ;
8+
9+ namespace Microsoft . CodeAnalysis . ExternalAccess . Razor ;
10+
11+ internal static class ITextBufferExtensions
12+ {
13+ public static bool TryGetTextDocument ( this ITextBuffer textBuffer , [ NotNullWhen ( true ) ] out TextDocument ? textDocument )
14+ {
15+ textDocument = textBuffer . CurrentSnapshot . AsText ( ) . GetOpenTextDocumentInCurrentContextWithChanges ( ) ;
16+ return textDocument is not null ;
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments