From fa02d34590035be6ccb80d87f3554e0011a5816b Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 29 Jul 2018 12:23:23 -0700 Subject: [PATCH 1/2] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 21 +++++++++++---------- korebuild-lock.txt | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 0b67201c91..f82223286d 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 2.2.0-preview1-17099 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 + 2.2.0-preview1-17102 + 2.2.0-preview1-34823 + 2.2.0-preview1-34823 + 2.2.0-preview1-34823 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 + 2.2.0-preview1-34823 + 2.2.0-preview1-34823 2.1.0 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 + 2.2.0-preview1-34823 + 2.2.0-preview1-34823 2.0.9 2.1.2 2.2.0-preview1-26618-02 @@ -57,10 +57,11 @@ 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 - 0.9.0 + 0.10.0 2.3.1 - 2.4.0-rc.1.build4038 + 2.4.0 + diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 8b9d17825f..28cd6a5b03 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.2.0-preview1-17099 -commithash:263ed1db9866b6b419b1f5d5189a712aa218acb3 +version:2.2.0-preview1-17102 +commithash:e7e2b5a97ca92cfc6acc4def534cb0901a6d1eb9 From cb557cf77173414c39e8fd4524ab38c0d5799725 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 18 Jul 2018 17:52:13 -0700 Subject: [PATCH 2/2] Changed `GetDesiredIndentation` to be resilient to our SyntaxTree which occasionally has gaps. - Added a test to cover the scenario. #2489 --- .../DefaultRazorIndentationFactsService.cs | 2 +- ...DefaultRazorIndentationFactsServiceTest.cs | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs index 109ba1311b..f69274fa15 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs @@ -64,7 +64,7 @@ namespace Microsoft.VisualStudio.Editor.Razor var previousLineEndIndex = GetPreviousLineEndIndex(syntaxTreeSnapshot, line); var simulatedChange = new SourceChange(previousLineEndIndex, 0, string.Empty); var owningSpan = syntaxTree.Root.LocateOwner(simulatedChange); - if (owningSpan.Kind == SpanKindInternal.Code) + if (owningSpan == null || owningSpan.Kind == SpanKindInternal.Code) { // Example, // @{\n diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs index 2045d1a4f6..dcc7c8cadc 100644 --- a/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs @@ -167,6 +167,33 @@ namespace Microsoft.VisualStudio.Editor.Razor Assert.Equal(0, indentLevel); } + // This test verifies that we still operate on SyntaxTree's that have gaps in them. The gaps are temporary + // until our work with the parser has been completed. + [Fact] + public void GetDesiredIndentation_ReturnsNull_IfOwningSpanDoesNotExist() + { + // Arrange + var source = new StringTextSnapshot($@" +
+
+
+
+"); + var syntaxTree = GetSyntaxTree(new StringTextSnapshot("something else")); + var service = new DefaultRazorIndentationFactsService(); + + // Act + var indentation = service.GetDesiredIndentation( + syntaxTree, + source, + source.GetLineFromLineNumber(3), + indentSize: 4, + tabSize: 1); + + // Assert + Assert.Null(indentation); + } + [Fact] public void GetDesiredIndentation_ReturnsNull_IfOwningSpanIsCode() {