The WebTools team is changing razor content types per the razor team's request.

Razor => LegacyRazor
RazorCSharp => LegacyRazorCSharp
RazorCoreCSharp => LegacyRazorCoreCSharp
RazorVisualBasic => LegacyRazorVisualBasic

See https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1338541
This commit is contained in:
Todd Grunke 2021-06-09 12:02:46 -07:00
Родитель b5f45bdfc7
Коммит ce35df8f11
8 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -16,6 +16,7 @@ namespace Microsoft.VisualStudio.Editor.Razor.Completion
[Export(typeof(IAsyncCompletionCommitManagerProvider))]
[Name("Razor directive attribute completion commit provider.")]
[ContentType(RazorLanguage.CoreContentType)]
[ContentType(RazorConstants.LegacyCoreContentType)]
internal class RazorDirectiveAttributeCommitManagerProvider : IAsyncCompletionCommitManagerProvider
{
public IAsyncCompletionCommitManager GetOrCreate(ITextView textView)

Просмотреть файл

@ -18,6 +18,7 @@ namespace Microsoft.VisualStudio.Editor.Razor.Completion
[Export(typeof(IAsyncCompletionSourceProvider))]
[Name("Razor directive attribute completion provider.")]
[ContentType(RazorLanguage.CoreContentType)]
[ContentType(RazorConstants.LegacyCoreContentType)]
internal class RazorDirectiveAttributeCompletionSourceProvider : IAsyncCompletionSourceProvider
{
private readonly ForegroundDispatcher _foregroundDispatcher;

Просмотреть файл

@ -17,6 +17,7 @@ namespace Microsoft.VisualStudio.Editor.Razor.Completion
[Export(typeof(IAsyncCompletionSourceProvider))]
[Name("Razor directive completion provider.")]
[ContentType(RazorLanguage.CoreContentType)]
[ContentType(RazorConstants.LegacyCoreContentType)]
internal class RazorDirectiveCompletionSourceProvider : IAsyncCompletionSourceProvider
{
private readonly ForegroundDispatcher _foregroundDispatcher;

Просмотреть файл

@ -0,0 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.VisualStudio.Editor.Razor
{
internal static class RazorConstants
{
public const string LegacyContentType = "LegacyRazorCSharp";
public const string LegacyCoreContentType = "LegacyRazorCoreCSharp";
}
}

Просмотреть файл

@ -12,6 +12,7 @@ using Microsoft.VisualStudio.Utilities;
namespace Microsoft.VisualStudio.Editor.Razor
{
[ContentType(RazorLanguage.CoreContentType)]
[ContentType(RazorConstants.LegacyCoreContentType)]
[TextViewRole(PredefinedTextViewRoles.Document)]
[Export(typeof(ITextViewConnectionListener))]
internal class RazorTextViewConnectionListener : ITextViewConnectionListener

Просмотреть файл

@ -3,6 +3,7 @@
using System;
using Microsoft.CodeAnalysis.Razor;
using Microsoft.VisualStudio.Editor.Razor;
namespace Microsoft.VisualStudio.Text
{
@ -15,7 +16,7 @@ namespace Microsoft.VisualStudio.Text
throw new ArgumentNullException(nameof(textBuffer));
}
return textBuffer.ContentType.IsOfType(RazorLanguage.CoreContentType);
return textBuffer.ContentType.IsOfType(RazorLanguage.CoreContentType) || textBuffer.ContentType.IsOfType(RazorConstants.LegacyCoreContentType);
}
}
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.VisualStudio.Editor.Razor.Completion
{
public class RazorDirectiveCompletionSourceProviderTest : ForegroundDispatcherTestBase
{
private IContentType RazorContentType { get; } = Mock.Of<IContentType>(c => c.IsOfType(RazorLanguage.ContentType) == true, MockBehavior.Strict);
private IContentType RazorContentType { get; } = Mock.Of<IContentType>(c => c.IsOfType(RazorLanguage.ContentType) || c.IsOfType(RazorConstants.LegacyContentType), MockBehavior.Strict);
private IContentType NonRazorContentType { get; } = Mock.Of<IContentType>(c => c.IsOfType(It.IsAny<string>()) == false, MockBehavior.Strict);

Просмотреть файл

@ -22,7 +22,7 @@ namespace Microsoft.VisualStudio.Editor.Razor
{
public DefaultVisualStudioDocumentTrackerTest()
{
RazorCoreContentType = Mock.Of<IContentType>(c => c.IsOfType(RazorLanguage.ContentType) == true, MockBehavior.Strict);
RazorCoreContentType = Mock.Of<IContentType>(c => c.IsOfType(RazorLanguage.ContentType) || c.IsOfType(RazorConstants.LegacyContentType), MockBehavior.Strict);
TextBuffer = Mock.Of<ITextBuffer>(b => b.ContentType == RazorCoreContentType, MockBehavior.Strict);
FilePath = TestProjectData.SomeProjectFile1.FilePath;