From b3d727b6318e2c9cfe13c063ebf7271ee96e14d4 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 7 Mar 2019 15:49:29 -0800 Subject: [PATCH] Enable IntelliSense for new component parameters. - Added a `FilePathComparison` object since not all string methods allow a comparer. - Updated `RazorDirectiveCompletionProvider` to also understand `.razor` files. This is an edge case scenario where users have disabled modern completion and are using Razor components (you need a reg key to disable the modern completion or MS needs to disable it). - Tested this in VS by referencing the latest Razor SDK (preview 3) from NuGet and then replacing the Razor design time targets in VS to be the ones from the preview 3 package. - Added workspace project state change detector tests. dotnet/aspnetcore-tooling#8064 \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/6a83ed13fcb127cae7e89414e878e075352fdbe4 --- .../src/FilePathComparison.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/Razor/Microsoft.CodeAnalysis.Razor/src/FilePathComparison.cs diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/FilePathComparison.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/FilePathComparison.cs new file mode 100644 index 0000000000..057f71cb86 --- /dev/null +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/FilePathComparison.cs @@ -0,0 +1,30 @@ +// 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; +using System.Runtime.InteropServices; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal static class FilePathComparison + { + private static StringComparison? _instance; + + public static StringComparison Instance + { + get + { + if (_instance == null && RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + _instance = StringComparison.Ordinal; + } + else if (_instance == null) + { + _instance = StringComparison.OrdinalIgnoreCase; + } + + return _instance.Value; + } + } + } +}