diff --git a/eng/Version.Details.props b/eng/Version.Details.props index cf1ad4498bd..ec7a1faefbe 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -7,27 +7,27 @@ This file should be imported by eng/Versions.props - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 - 5.0.0-2.25406.1 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 + 5.0.0-2.25418.8 9.0.0-beta.25255.5 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3c800bf81d8..0f66a580b58 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,89 +2,89 @@ - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef - + https://github.com/dotnet/roslyn - 5759a992418f0fd3e206cc6f369b6f33e873dfca + 8405da69a543a680aab32ede20062e22602d3aef diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperRewritePhase.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperRewritePhase.cs index 4eac7780054..ae6b5340900 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperRewritePhase.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperRewritePhase.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Immutable; using System.Threading; using Microsoft.AspNetCore.Razor.Language.Legacy; @@ -14,7 +15,9 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, Cancellation !codeDocument.TryGetTagHelperContext(out var context) || context.TagHelpers is []) { - // No descriptors, no-op. + // No descriptors, so no need to see if any are used. Without setting this though, + // we trigger an Assert in the ProcessRemaining method in the source generator. + codeDocument.SetReferencedTagHelpers(ImmutableHashSet.Empty); return; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs index ab0034d46bf..8b802d89a68 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs @@ -77,18 +77,28 @@ private static (SourceGeneratorProjectItem?, Diagnostic?) ComputeProjectItems((A var (additionalText, globalOptions) = pair; var options = globalOptions.GetOptions(additionalText); - if (!options.TryGetValue("build_metadata.AdditionalFiles.TargetPath", out var encodedRelativePath) || - string.IsNullOrWhiteSpace(encodedRelativePath)) + string relativePath; + if (options.TryGetValue("build_metadata.AdditionalFiles.TargetPath", out var encodedRelativePath)) { - var diagnostic = Diagnostic.Create( - RazorDiagnostics.TargetPathNotProvided, - Location.None, - additionalText.Path); - return (null, diagnostic); + // TargetPath is optional, but must have a value if provided. + if (string.IsNullOrWhiteSpace(encodedRelativePath)) + { + var diagnostic = Diagnostic.Create( + RazorDiagnostics.TargetPathNotProvided, + Location.None, + additionalText.Path); + return (null, diagnostic); + } + + relativePath = Encoding.UTF8.GetString(Convert.FromBase64String(encodedRelativePath)); + } + else + { + // If the TargetPath is not provided, we effectively assume its in the root of the project. + relativePath = Path.GetFileName(additionalText.Path); } options.TryGetValue("build_metadata.AdditionalFiles.CssScope", out var cssScope); - var relativePath = Encoding.UTF8.GetString(Convert.FromBase64String(encodedRelativePath)); var projectItem = new SourceGeneratorProjectItem( basePath: "/", diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/IncompatibleProjectService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/IncompatibleProjectService.cs index 49c266859df..34a3e6bddd7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/IncompatibleProjectService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/IncompatibleProjectService.cs @@ -16,20 +16,10 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; [method: ImportingConstructor] internal sealed class IncompatibleProjectService(IIncompatibleProjectNotifier incompatibleProjectNotifier) : IIncompatibleProjectService { - private static readonly ProjectId s_miscFilesProject = ProjectId.CreateNewId(); - private readonly IIncompatibleProjectNotifier _incompatibleProjectNotifier = incompatibleProjectNotifier; private ImmutableHashSet _incompatibleProjectIds = []; - public void HandleMiscFilesDocument(TextDocument textDocument) - { - if (ImmutableInterlocked.Update(ref _incompatibleProjectIds, static set => set.Add(s_miscFilesProject))) - { - _incompatibleProjectNotifier.NotifyMiscFilesDocument(textDocument); - } - } - public void HandleMissingDocument(RazorTextDocumentIdentifier? textDocumentIdentifier, RazorCohostRequestContext context) { if (context.Solution is null) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/Microsoft.CodeAnalysis.Razor.CohostingShared.projitems b/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/Microsoft.CodeAnalysis.Razor.CohostingShared.projitems index 9737517b6da..c56f537c158 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/Microsoft.CodeAnalysis.Razor.CohostingShared.projitems +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/Microsoft.CodeAnalysis.Razor.CohostingShared.projitems @@ -38,6 +38,7 @@ + diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/RazorSourceGeneratorLocator.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/RazorSourceGeneratorLocator.cs new file mode 100644 index 00000000000..e8bb0d1da08 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/RazorSourceGeneratorLocator.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Features; +using Microsoft.NET.Sdk.Razor.SourceGenerators; + +namespace Microsoft.CodeAnalysis.Razor.CohostingShared; + +[Export(typeof(IRazorSourceGeneratorLocator))] +[method: ImportingConstructor] +internal sealed class RazorSourceGeneratorLocator() : IRazorSourceGeneratorLocator +{ + public string GetGeneratorFilePath() + { + return typeof(RazorSourceGenerator).Assembly.Location; + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/AbstractCohostDocumentEndpoint.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/AbstractCohostDocumentEndpoint.cs index 6cbf4ca25b1..a5684963bc8 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/AbstractCohostDocumentEndpoint.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/AbstractCohostDocumentEndpoint.cs @@ -22,15 +22,6 @@ internal abstract class AbstractCohostDocumentEndpoint( return SpecializedTasks.Default(); } - if (context.TextDocument.Project.FilePath is null) - { - // If the project file path is null, we can't compute the hint name, so we can't handle the request. - // This is likely a file in the misc files project, which we don't support yet anyway. - // TODO: Expose context.TextDocument.Project.Solution.WorkspaceKind through our EA to confirm? - _incompatibleProjectService.HandleMiscFilesDocument(context.TextDocument); - return SpecializedTasks.Default(); - } - return HandleRequestAsync(request, context, context.TextDocument, cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectNotifier.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectNotifier.cs index 81fe7992dd4..282daec12a4 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectNotifier.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectNotifier.cs @@ -5,6 +5,5 @@ namespace Microsoft.CodeAnalysis.Razor.Cohost; internal interface IIncompatibleProjectNotifier { - void NotifyMiscFilesDocument(TextDocument textDocument); void NotifyMissingDocument(Project project, string filePath); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectService.cs index 8af883a5a5f..788543bda57 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Cohost/IIncompatibleProjectService.cs @@ -7,6 +7,5 @@ namespace Microsoft.CodeAnalysis.Razor.Cohost; internal interface IIncompatibleProjectService { - void HandleMiscFilesDocument(TextDocument textDocument); void HandleMissingDocument(RazorTextDocumentIdentifier? textDocumentIdentifier, RazorCohostRequestContext context); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/TextDocumentExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/TextDocumentExtensions.cs index 1909970f85b..3d7f24baa6f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/TextDocumentExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/TextDocumentExtensions.cs @@ -26,6 +26,13 @@ public static bool TryComputeHintNameFromRazorDocument(this TextDocument razorDo } var filePath = razorDocument.FilePath.AsSpanOrDefault(); + if (string.IsNullOrEmpty(razorDocument.Project.FilePath)) + { + var fileName = filePath[filePath.LastIndexOfAny(['/', '\\'])..].TrimStart(['/', '\\']); + hintName = RazorSourceGenerator.GetIdentifierFromPath(fileName); + return hintName is not null; + } + var projectFilePath = razorDocument.Project.FilePath.AsSpanOrDefault(); var projectBasePath = PathUtilities.GetDirectoryName(projectFilePath); if (filePath.Length <= projectBasePath.Length) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/SR.resx b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/SR.resx index 6b2ccb301f3..f406690a6e9 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/SR.resx +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/SR.resx @@ -214,9 +214,6 @@ Simplify tag to self-closing - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has Razor documents but this file is not an AdditionalFile, so the editing experience will be limited. No more messages will be logged for this project. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf index ff9daf39df0..42df5a9025d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf @@ -84,11 +84,6 @@ Generovat obslužnou rutinu události {0} - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Editor Razor využívá Generátor zdroje Razor. {0} nejspíše není součástí žádného projektu, takže generátor zdroje není přítomen a možnosti úprav budou omezené. Pro tento scénář se nebudou protokolovat žádné další zprávy. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Editor Razor využívá Generátor zdroje Razor, který vyžaduje, aby soubory *.razor a *.cshtml v projektu byly AdditionalFiles. {0} nejspíš pochází z: {1} a neobsahuje žádné dokumenty Razor, které jsou AdditionalFiles, takže možnosti úprav budou omezené. Používá sadu Razor SDK? Pro tento projekt se nebudou protokolovat žádné další zprávy. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf index bf54a21629d..c393cee508a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf @@ -84,11 +84,6 @@ Ereignishandler "{0}" generieren - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Der Razor-Editor verwendet den Razor-Quellgenerator. {0} scheint nicht Teil eines Projekts zu sein, sodass der Quellgenerator nicht vorhanden ist und die Bearbeitungserfahrung eingeschränkt ist. Für dieses Szenario werden keine weiteren Nachrichten protokolliert. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Der Razor-Editor verwendet den Razor-Quellgenerator, der *.razor- und *.cshtml-Dateien als AdditionalFiles im Projekt erfordert. {0} scheint von „{1}“ zu stammen, das keine Razor-Dokumente enthält, die "AdditionalFiles" sind, sodass die Bearbeitungserfahrung eingeschränkt ist. Wird das Razor SDK verwendet? Für dieses Projekt werden keine weiteren Nachrichten protokolliert. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf index bd9cba28b3a..b6025490d1d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf @@ -84,11 +84,6 @@ Generar controlador de eventos ''{0}'' - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - El editor de Razor usa el generador de código fuente de Razor. {0} parece que no forma parte de ningún proyecto, por lo que el generador de origen no está presente y la experiencia de edición será limitada. No se registrarán más mensajes para este escenario. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. El editor de Razor usa Razor Source Generator, que requiere que los archivos *.razor y *.cshtml sean AdditionalFiles en el proyecto. {0} parece venir de "{1}", que no tiene documentos de Razor que sean AdditionalFiles, por lo que la experiencia de edición será limitada. ¿Usa el SDK de Razor? No se registrarán más mensajes para este proyecto. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf index 87430e31a93..ef64355555b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf @@ -84,11 +84,6 @@ Générer le gestionnaire d’événements '{0}' - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - L’éditeur Razor utilise le générateur de source Razor. {0} semble ne faire partie d’aucun projet, le générateur source n’est donc pas présent et l’expérience d’édition sera limitée. Aucun autre message ne sera enregistré pour ce scénario. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. L’éditeur Razor utilise le générateur de source Razor, qui requiert que les fichiers *.razor et *.cshtml soient AdditionalFiles dans le projet. {0} semble provenir de '{1}', qui ne contient aucun document Razor qui sont des AdditionalFiles. L’expérience d’édition sera donc limitée. Utilise-t-il le kit de développement logiciel (SDK) Razor ? Aucun autre message ne sera enregistré pour ce projet. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf index c8451feaf9e..09d944da93e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf @@ -84,11 +84,6 @@ Genera gestore dell'evento '{0}' - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - L'editor Razor usa il generatore di origine Razor. {0} sembra non far parte di alcun progetto, quindi il generatore di origine non è presente e l'esperienza di modifica sarà limitata. Non verranno registrati altri messaggi per questo scenario. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. L'editor Razor usa il generatore di origine Razor, che richiede che i file *.razor e *.cshtml siano AdditionalFiles nel progetto. {0} sembra provenire da '{1}', che non contiene documenti Razor classificati come AdditionalFiles, quindi l'esperienza di modifica sarà limitata. Si sta utilizzando Razor SDK? Non verranno registrati altri messaggi per questo progetto. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf index 01feb8c0981..96bec9b48b2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf @@ -84,11 +84,6 @@ イベント ハンドラー '{0}' の生成 - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Razor エディターは Razor ソース ジェネレーターを利用します。{0} はどのプロジェクトにも含まれていないように見えるので、ソース ジェネレーターが存在せず、編集エクスペリエンスが制限されます。このシナリオでは、これ以上メッセージはログに記録されません。 - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Razor エディターは Razor ソース ジェネレーターを利用します。これには、*.razor および *.cshtml ファイルがプロジェクトの AddedFiles である必要があります。{0} は、'{1}' から取得されたようですが、これには AddedFiles である Razor ドキュメントがないため、編集エクスペリエンスが制限されます。Razor SDK を使用していますか?このプロジェクトのメッセージはこれ以上ログに記録されません。 diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf index 7ee07123f13..1e42f2e9510 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf @@ -84,11 +84,6 @@ 이벤트 처리기 '{0}' 생성 - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Razor 편집기는 Razor 원본 생성기를 활용합니다. {0}은(는) 프로젝트의 일부가 아니므로 원본 생성기가 없고 편집 환경이 제한됩니다. 이 시나리오에 대해 더 이상 메시지가 기록되지 않습니다. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Razor 편집기는 프로젝트의 AdditionalFiles이 *.razor 및 *.cshtml 파일이어야 하는 Razor 원본 생성기를 사용합니다. {0}은(는) AdditionalFiles인 Razor 문서가 포함되지 않은 '{1}'에서 가져왔으므로 편집 환경이 제한됩니다. Razor SDK를 사용하고 계십니까? 이 프로젝트에 대해 더 이상 메시지가 기록되지 않습니다. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf index 5c2af99f0de..1a9711bfde7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf @@ -84,11 +84,6 @@ Generuj obsługę zdarzeń „{0}” - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Edytor Razor korzysta z generatora źródła Razor. Wygląda na to, że {0} nie należy do żadnego projektu, więc generator źródła nie jest obecny i środowisko edycji będzie ograniczone. W tym scenariuszu nie będą rejestrowane żadne inne widomości. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Edytor Razor korzysta z generatora źródła Razor, który wymaga, aby pliki *.razor i *.cshtml były plikami AdditionalFiles w projekcie. Wygląda na to, że {0} pochodzi z folderu „{1}”, który nie zawiera dokumentów usługi Razor będących plikami AdditionalFiles, więc środowisko edycji będzie ograniczone. Czy używa zestawu Razor SDK? Dla tego projektu nie będą rejestrowane żadne inne wiadomości. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf index 9312e3632f5..fee4ff24f59 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf @@ -84,11 +84,6 @@ Gerar manipulador de eventos '{0}' - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - O editor Razor utiliza o Razor Source Generator. {0} não parece fazer parte de nenhum projeto, portanto, o gerador de código-fonte não está presente e a experiência de edição será limitada. Nenhuma outra mensagem será registrada para este cenário. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. O editor Razor utiliza o Razor Source Generator, que exige que arquivos \*.razor e \*.cshtml sejam especificados como AdditionalFiles no projeto. {0} parece vir de '{1}', que não contém documentos Razor como AdditionalFiles, portanto, a experiência de edição será limitada. Está usando o SDK do Razor? Nenhuma outra mensagem será registrada para este projeto. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf index f9285089c80..f0b27b0b57a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf @@ -84,11 +84,6 @@ Создать обработчик событий "{0}" - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Редактор Razor использует генератор источника Razor. {0} не является частью какого-либо проекта, поэтому генератор источника отсутствует, а возможности редактирования будут ограничены. Для этого сценария больше не будут регистрироваться сообщения в журнале. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Редактор Razor использует генератор источника Razor, который требует, чтобы файлы *.razor и *.cshtml были файлами AdditionalFile в проекте. {0} поступает из "{1}", где нет документов Razor, которые являются файлами AdditionalFile, поэтому возможности редактирования будут ограничены. Используется ли пакет SDK Razor? Для этого проекта больше не будут регистрироваться сообщения в журнале. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf index 17462c8f7e7..69a944d2c51 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf @@ -84,11 +84,6 @@ '{0}' Olay İşleyicisi Oluştur - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Razor düzenleyici, Razor Kaynak Oluşturucuyu kullanır. {0} herhangi bir projenin parçası değil gibi görünüyor, bu nedenle kaynak oluşturucu mevcut değildir ve düzenleme deneyimi sınırlı olacaktır. Bu senaryo için başka mesajlar günlüğe kaydedilmeyecektir. - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Razor düzenleyici, *.razor ve *.cshtml dosyalarının projede AdditionalFiles olmasını gerektiren Razor Kaynak Oluşturucuyu kullanır. {0}, AdditionalFile olan herhangi bir Razor belgesine sahip olmayan '{1}' dosyasından geliyor gibi görünüyor, bu nedenle düzenleme deneyimi sınırlı olacaktır. Razor SDK'sını kullanıyor mu? Bu proje için başka mesajlar günlüğe kaydedilmeyecektir. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf index 718d258dfcc..45b2ec594d2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf @@ -84,11 +84,6 @@ 生成事件处理程序 "{0}" - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Razor 编辑器使用 Razor 源生成器。{0} 似乎不属于任何项目,因此源生成器不存在,编辑体验将受到限制。对于此应用场景,将不会记录更多消息。 - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Razor 编辑器使用 Razor 源生成器,这要求 *.razor 和 *.cshtml 文件是项目中的 AdditionalFile。{0} 似乎来自“{1}”,其中不包含任何为 AdditionalFile 的 Razor 文档,因此编辑体验将受到限制。它使用的是 Razor SDK 吗?对于此项目,将不会记录更多消息。 diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf index 13fd9aaf216..dccee2767ce 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf @@ -84,11 +84,6 @@ 產生事件處理常式 '{0}' - - The Razor editor utilizes the Razor Source Generator. {0} appears to not be part of any project, so the source generator is not present and the editing experience will be limited. No more messages will be logged for this scenario. - Razor 編輯器會使用 Razor 原始碼產生器。{0} 似乎不是任何專案的一部分,因此原始碼產生器不存在,且編輯體驗將會受到限制。系統將不會再記錄此案例的任何訊息。 - - The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. {0} appears to come from '{1}', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project. Razor 編輯器會使用 Razor 原始碼產生器,其需要在專案中將 *.razor 和 *.cshtml 檔案設為 AdditionalFiles。{0} 似乎來自 '{1}',其沒有設為 AdditionalFiles 的 Razor 文件,因此編輯體驗將會受到限制。是否使用 Razor SDK?系統將不會再記錄此專案的任何訊息。 diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs index eb95527ba97..1cede2ff218 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; @@ -220,6 +221,11 @@ public bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSna #pragma warning disable RSEXPERIMENTAL004 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. if (!runResult.HostOutputs.TryGetValue(nameof(RazorGeneratorResult), out var objectResult) || objectResult is not RazorGeneratorResult generatorResult) { + Debug.Fail($""" + No RazorGeneratorResult found in host outputs for project '{_project.Name}': + {string.Join(Environment.NewLine, runResult.Diagnostics)} + """); + return null; } #pragma warning restore RSEXPERIMENTAL004 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/IncompatibleProjectNotifier.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/IncompatibleProjectNotifier.cs index d6d7ff6f1b5..ff8e68f9378 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/IncompatibleProjectNotifier.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/IncompatibleProjectNotifier.cs @@ -28,12 +28,6 @@ internal sealed class IncompatibleProjectNotifier( private readonly HashSet _frameworkProjects = new(PathUtilities.OSSpecificPathComparer); private readonly ITelemetryReporter _telemetryReporter = telemetryReporter; - public void NotifyMiscFilesDocument(TextDocument textDocument) - { - _telemetryReporter.ReportEvent("cohost/miscFilesDocument", Severity.Normal); - _logger.Log(LogLevel.Error, $"{WorkspacesSR.FormatIncompatibleProject_MiscFiles(Path.GetFileName(textDocument.FilePath))}"); - } - public void NotifyMissingDocument(Project project, string filePath) { // When this document was opened, we will have checked if it was a .NET Framework project, and we listened for that below. diff --git a/src/Razor/src/Microsoft.VisualStudioCode.RazorExtension/Services/IncompatibleProjectNotifier.cs b/src/Razor/src/Microsoft.VisualStudioCode.RazorExtension/Services/IncompatibleProjectNotifier.cs index 20bc8bb2dd5..4dc18f62393 100644 --- a/src/Razor/src/Microsoft.VisualStudioCode.RazorExtension/Services/IncompatibleProjectNotifier.cs +++ b/src/Razor/src/Microsoft.VisualStudioCode.RazorExtension/Services/IncompatibleProjectNotifier.cs @@ -24,12 +24,6 @@ internal sealed class IncompatibleProjectNotifier( private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private readonly ITelemetryReporter _telemetryReporter = telemetryReporter; - public void NotifyMiscFilesDocument(TextDocument textDocument) - { - _telemetryReporter.ReportEvent("cohost/miscFilesDocument", Severity.Normal); - _logger.Log(LogLevel.Error, $"{WorkspacesSR.FormatIncompatibleProject_MiscFiles(Path.GetFileName(textDocument.FilePath))}"); - } - public void NotifyMissingDocument(Project project, string filePath) { _telemetryReporter.ReportEvent("cohost/missingDocument", Severity.Normal); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/CohostCodeActionsEndpointTestBase.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/CohostCodeActionsEndpointTestBase.cs index eb834d3d619..c2d2f45b19e 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/CohostCodeActionsEndpointTestBase.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/CohostCodeActionsEndpointTestBase.cs @@ -36,10 +36,11 @@ private protected async Task VerifyCodeActionAsync( string codeActionName, int childActionIndex = 0, RazorFileKind? fileKind = null, + string? documentFilePath = null, (string filePath, string contents)[]? additionalFiles = null, (Uri fileUri, string contents)[]? additionalExpectedFiles = null) { - var document = CreateRazorDocument(input, fileKind, additionalFiles); + var document = CreateRazorDocument(input, fileKind, documentFilePath, additionalFiles); var codeAction = await VerifyCodeActionRequestAsync(document, input, codeActionName, childActionIndex, expectOffer: expected is not null); @@ -56,7 +57,7 @@ private protected async Task VerifyCodeActionAsync( await VerifyCodeActionResultAsync(document, workspaceEdit, expected, additionalExpectedFiles); } - private protected TextDocument CreateRazorDocument(TestCode input, RazorFileKind? fileKind = null, (string filePath, string contents)[]? additionalFiles = null) + private protected TextDocument CreateRazorDocument(TestCode input, RazorFileKind? fileKind = null, string? documentFilePath = null, (string filePath, string contents)[]? additionalFiles = null) { var fileSystem = (RemoteFileSystem)OOPExportProvider.GetExportedValue(); fileSystem.GetTestAccessor().SetFileSystem(new TestFileSystem(additionalFiles)); @@ -74,7 +75,7 @@ private protected TextDocument CreateRazorDocument(TestCode input, RazorFileKind return options; }); - return CreateProjectAndRazorDocument(input.Text, fileKind, createSeparateRemoteAndLocalWorkspaces: true, additionalFiles: additionalFiles); + return CreateProjectAndRazorDocument(input.Text, fileKind, documentFilePath, createSeparateRemoteAndLocalWorkspaces: true, additionalFiles: additionalFiles); } private async Task VerifyCodeActionRequestAsync(TextDocument document, TestCode input, string codeActionName, int childActionIndex, bool expectOffer) diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/PromoteUsingDirectiveTests.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/PromoteUsingDirectiveTests.cs index 8a64c7412b4..94206c090be 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/PromoteUsingDirectiveTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CodeActions/PromoteUsingDirectiveTests.cs @@ -99,8 +99,9 @@ @using [||]System Hello World """, + documentFilePath: FilePath(@"My\Deeply\Nested\File.razor"), additionalFiles: [ - (FilePath(@"..\_Imports.razor"), """ + (FilePath(@"My\Deeply\_Imports.razor"), """ @using System.Text @using Foo.Bar """)], @@ -112,7 +113,7 @@ Hello World """, codeActionName: LanguageServerConstants.CodeActions.PromoteUsingDirective, additionalExpectedFiles: [ - (FileUri(@"..\_Imports.razor"), """ + (FileUri(@"My\Deeply\_Imports.razor"), """ @using System.Text @using Foo.Bar @using System @@ -130,8 +131,9 @@ @using [||]System Hello World """, + documentFilePath: FilePath(@"My\Deeply\Nested\File.razor"), additionalFiles: [ - (FilePath(@"..\_Imports.razor"), """ + (FilePath(@"My\Deeply\_Imports.razor"), """ @using System.Text @using Foo.Bar @@ -144,7 +146,7 @@ Hello World """, codeActionName: LanguageServerConstants.CodeActions.PromoteUsingDirective, additionalExpectedFiles: [ - (FileUri(@"..\_Imports.razor"), """ + (FileUri(@"My\Deeply\_Imports.razor"), """ @using System.Text @using Foo.Bar @using System @@ -162,8 +164,9 @@ @using [||]System Hello World """, + documentFilePath: FilePath(@"My\Deeply\Nested\File.razor"), additionalFiles: [ - (FilePath(@"..\_Imports.razor"), """ + (FilePath(@"My\Deeply\_Imports.razor"), """ @using System.Text @using Foo.Bar @@ -176,7 +179,7 @@ Hello World """, codeActionName: LanguageServerConstants.CodeActions.PromoteUsingDirective, additionalExpectedFiles: [ - (FileUri(@"..\_Imports.razor"), """ + (FileUri(@"My\Deeply\_Imports.razor"), """ @using System.Text @using Foo.Bar @using System diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentPullDiagnosticsTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentPullDiagnosticsTest.cs index 4b158add91d..d9c58d93d63 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentPullDiagnosticsTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentPullDiagnosticsTest.cs @@ -43,6 +43,25 @@ public Task Razor() """); + [Fact] + public Task CSharpAndRazor_MiscellaneousFile() + => VerifyDiagnosticsAsync(""" +
+ + {|RZ10012:|} + +
+ + @code + { + public void IJustMetYou() + { + {|CS0103:CallMeMaybe|}(); + } + } + """, + miscellaneousFile: true); + [Fact] public Task Html() { @@ -387,9 +406,9 @@ public Task TODOComments() """, taskListRequest: true); - private async Task VerifyDiagnosticsAsync(TestCode input, VSInternalDiagnosticReport[]? htmlResponse = null, bool taskListRequest = false) + private async Task VerifyDiagnosticsAsync(TestCode input, VSInternalDiagnosticReport[]? htmlResponse = null, bool taskListRequest = false, bool miscellaneousFile = false) { - var document = CreateProjectAndRazorDocument(input.Text, createSeparateRemoteAndLocalWorkspaces: true); + var document = CreateProjectAndRazorDocument(input.Text, createSeparateRemoteAndLocalWorkspaces: true, miscellaneousFile: miscellaneousFile); var inputText = await document.GetTextAsync(DisposalToken); var requestInvoker = new TestHtmlRequestInvoker([(VSInternalMethods.DocumentPullDiagnosticName, htmlResponse)]); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSymbolEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSymbolEndpointTest.cs index f17f7cceb4a..ce7c716b34d 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSymbolEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSymbolEndpointTest.cs @@ -43,6 +43,33 @@ class {|SomeProject.File1.C:C|} """, hierarchical); + [Theory] + [CombinatorialData] + public Task DocumentSymbols_CSharpClassWithMethods_MiscFile(bool hierarchical) + => VerifyDocumentSymbolsAsync( + """ + @functions { + class {|ASP.File1.C:C|} + { + private void {|HandleString(string s):HandleString|}(string s) + { + s += "Hello"; + } + + private void {|M(int i):M|}(int i) + { + i++; + } + + private string {|ObjToString(object o):ObjToString|}(object o) + { + return o.ToString(); + } + } + } + + """, hierarchical, miscellaneousFile: true); + [Theory] [CombinatorialData] public Task DocumentSymbols_CSharpMethods(bool hierarchical) @@ -67,10 +94,10 @@ public Task DocumentSymbols_CSharpMethods(bool hierarchical) """, hierarchical); - private async Task VerifyDocumentSymbolsAsync(string input, bool hierarchical = false) + private async Task VerifyDocumentSymbolsAsync(string input, bool hierarchical = false, bool miscellaneousFile = false) { TestFileMarkupParser.GetSpans(input, out input, out ImmutableDictionary> spansDict); - var document = CreateProjectAndRazorDocument(input); + var document = CreateProjectAndRazorDocument(input, miscellaneousFile: miscellaneousFile); var endpoint = new CohostDocumentSymbolEndpoint(IncompatibleProjectService, RemoteServiceInvoker); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs index e56f8fcf7df..9d1cb80e7b8 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs @@ -155,24 +155,24 @@ private protected virtual TestComposition ConfigureRoslynDevenvComposition(TestC protected TextDocument CreateProjectAndRazorDocument( string contents, RazorFileKind? fileKind = null, + string? documentFilePath = null, (string fileName, string contents)[]? additionalFiles = null, bool createSeparateRemoteAndLocalWorkspaces = false, - bool inGlobalNamespace = false) + bool inGlobalNamespace = false, + bool miscellaneousFile = false) { // Using IsLegacy means null == component, so easier for test authors var isComponent = fileKind != RazorFileKind.Legacy; - var documentFilePath = isComponent + documentFilePath ??= isComponent ? TestProjectData.SomeProjectComponentFile1.FilePath : TestProjectData.SomeProjectFile1.FilePath; - var projectFilePath = TestProjectData.SomeProject.FilePath; - var projectName = Path.GetFileNameWithoutExtension(projectFilePath); - var projectId = ProjectId.CreateNewId(debugName: projectName); + var projectId = ProjectId.CreateNewId(debugName: TestProjectData.SomeProject.DisplayName); var documentId = DocumentId.CreateNewId(projectId, debugName: documentFilePath); var remoteWorkspace = RemoteWorkspaceProvider.Instance.GetWorkspace(); - var remoteDocument = CreateProjectAndRazorDocument(remoteWorkspace, projectId, projectName, documentId, documentFilePath, contents, additionalFiles, inGlobalNamespace); + var remoteDocument = CreateProjectAndRazorDocument(remoteWorkspace, projectId, miscellaneousFile, documentId, documentFilePath, contents, additionalFiles, inGlobalNamespace); if (createSeparateRemoteAndLocalWorkspaces) { @@ -184,7 +184,7 @@ protected TextDocument CreateProjectAndRazorDocument( return CreateLocalProjectAndRazorDocument( remoteDocument.Project.Solution, projectId, - projectName, + miscellaneousFile, documentId, documentFilePath, contents, @@ -201,7 +201,7 @@ protected TextDocument CreateProjectAndRazorDocument( private TextDocument CreateLocalProjectAndRazorDocument( Solution remoteSolution, ProjectId projectId, - string projectName, + bool miscellaneousFile, DocumentId documentId, string documentFilePath, string contents, @@ -221,7 +221,7 @@ private TextDocument CreateLocalProjectAndRazorDocument( var workspace = TestWorkspace.CreateWithDiagnosticAnalyzers(RoslynDevenvExportProvider); AddDisposable(workspace); - var razorDocument = CreateProjectAndRazorDocument(workspace, projectId, projectName, documentId, documentFilePath, contents, additionalFiles, inGlobalNamespace); + var razorDocument = CreateProjectAndRazorDocument(workspace, projectId, miscellaneousFile, documentId, documentFilePath, contents, additionalFiles, inGlobalNamespace); // If we're creating remote and local workspaces, then we'll return the local document, and have to allow // the remote service invoker to map from the local solution to the remote one. @@ -230,8 +230,12 @@ private TextDocument CreateLocalProjectAndRazorDocument( return razorDocument; } - private TextDocument CreateProjectAndRazorDocument(CodeAnalysis.Workspace workspace, ProjectId projectId, string projectName, DocumentId documentId, string documentFilePath, string contents, (string fileName, string contents)[]? additionalFiles, bool inGlobalNamespace) + private TextDocument CreateProjectAndRazorDocument(CodeAnalysis.Workspace workspace, ProjectId projectId, bool miscellaneousFile, DocumentId documentId, string documentFilePath, string contents, (string fileName, string contents)[]? additionalFiles, bool inGlobalNamespace) { + // We simulate a miscellaneous file project by not having a project file path. + var projectFilePath = miscellaneousFile ? null : TestProjectData.SomeProject.FilePath; + var projectName = miscellaneousFile ? "" : Path.GetFileNameWithoutExtension(projectFilePath); + var sgAssembly = typeof(RazorSourceGenerator).Assembly; var projectInfo = ProjectInfo @@ -241,14 +245,15 @@ private TextDocument CreateProjectAndRazorDocument(CodeAnalysis.Workspace worksp name: projectName, assemblyName: projectName, LanguageNames.CSharp, - documentFilePath, + projectFilePath, compilationOptions: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) - .WithMetadataReferences(AspNet80.ReferenceInfos.All.Select(r => r.Reference)) - .WithDefaultNamespace(TestProjectData.SomeProject.RootNamespace) - // TODO: Can we just use an object reference? Trying to do so now results in a serialization error from Roslyn + .WithMetadataReferences( + miscellaneousFile + ? Net461.ReferenceInfos.All.Select(r => r.Reference) // This isn't quite what Roslyn does, but its close enough for our tests + : AspNet80.ReferenceInfos.All.Select(r => r.Reference)) .WithAnalyzerReferences([new AnalyzerFileReference(sgAssembly.Location, TestAnalyzerAssemblyLoader.LoadFromFile)]); - if (!inGlobalNamespace) + if (!miscellaneousFile && !inGlobalNamespace) { projectInfo = projectInfo.WithDefaultNamespace(TestProjectData.SomeProject.RootNamespace); } @@ -260,38 +265,41 @@ private TextDocument CreateProjectAndRazorDocument(CodeAnalysis.Workspace worksp documentId, documentFilePath, SourceText.From(contents), - filePath: documentFilePath) - .AddAdditionalDocument( - DocumentId.CreateNewId(projectId), - name: TestProjectData.SomeProjectComponentImportFile1.FilePath, - text: SourceText.From(""" + filePath: documentFilePath); + + if (!miscellaneousFile) + { + solution = solution.AddAdditionalDocument( + DocumentId.CreateNewId(projectId), + name: TestProjectData.SomeProjectComponentImportFile1.FilePath, + text: SourceText.From(""" @using Microsoft.AspNetCore.Components @using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web """), - filePath: TestProjectData.SomeProjectComponentImportFile1.FilePath) - .AddAdditionalDocument( - DocumentId.CreateNewId(projectId), - name: "_ViewImports.cshtml", - text: SourceText.From(""" + filePath: TestProjectData.SomeProjectComponentImportFile1.FilePath) + .AddAdditionalDocument( + DocumentId.CreateNewId(projectId), + name: "_ViewImports.cshtml", + text: SourceText.From(""" @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers """), - filePath: TestProjectData.SomeProjectImportFile.FilePath); + filePath: TestProjectData.SomeProjectImportFile.FilePath); - if (additionalFiles is not null) - { - foreach (var file in additionalFiles) + if (additionalFiles is not null) { - solution = Path.GetExtension(file.fileName) == ".cs" - ? solution.AddDocument(DocumentId.CreateNewId(projectId), name: file.fileName, text: SourceText.From(file.contents), filePath: file.fileName) - : solution.AddAdditionalDocument(DocumentId.CreateNewId(projectId), name: file.fileName, text: SourceText.From(file.contents), filePath: file.fileName); + foreach (var file in additionalFiles) + { + solution = Path.GetExtension(file.fileName) == ".cs" + ? solution.AddDocument(DocumentId.CreateNewId(projectId), name: file.fileName, text: SourceText.From(file.contents), filePath: file.fileName) + : solution.AddAdditionalDocument(DocumentId.CreateNewId(projectId), name: file.fileName, text: SourceText.From(file.contents), filePath: file.fileName); + } } - } - var globalConfigContent = new StringBuilder(); - globalConfigContent.AppendLine($""" + var globalConfigContent = new StringBuilder(); + globalConfigContent.AppendLine($""" is_global = true build_property.RazorLangVersion = {FallbackRazorConfiguration.Latest.LanguageVersion} @@ -299,27 +307,28 @@ @using Microsoft.AspNetCore.Components.Web build_property.RootNamespace = {TestProjectData.SomeProject.RootNamespace} """); - var projectBasePath = TestProjectData.SomeProjectPath; - // Normally MS Build targets do this for us, but we're on our own! - foreach (var razorDocument in solution.Projects.Single().AdditionalDocuments) - { - if (razorDocument.FilePath is not null && - razorDocument.FilePath.StartsWith(projectBasePath)) + var projectBasePath = Path.GetDirectoryName(projectFilePath); + // Normally MS Build targets do this for us, but we're on our own! + foreach (var razorDocument in solution.Projects.Single().AdditionalDocuments) { - var relativePath = razorDocument.FilePath[(projectBasePath.Length + 1)..]; - globalConfigContent.AppendLine($""" + if (razorDocument.FilePath is not null && + razorDocument.FilePath.StartsWith(projectBasePath)) + { + var relativePath = razorDocument.FilePath[(projectBasePath.Length + 1)..]; + globalConfigContent.AppendLine($""" [{razorDocument.FilePath.AssumeNotNull().Replace('\\', '/')}] build_metadata.AdditionalFiles.TargetPath = {Convert.ToBase64String(Encoding.UTF8.GetBytes(relativePath))} """); + } } - } - solution = solution.AddAnalyzerConfigDocument( - DocumentId.CreateNewId(projectId), - name: ".globalconfig", - text: SourceText.From(globalConfigContent.ToString()), - filePath: Path.Combine(TestProjectData.SomeProjectPath, ".globalconfig")); + solution = solution.AddAnalyzerConfigDocument( + DocumentId.CreateNewId(projectId), + name: ".globalconfig", + text: SourceText.From(globalConfigContent.ToString()), + filePath: Path.Combine(TestProjectData.SomeProjectPath, ".globalconfig")); + } return solution.GetAdditionalDocument(documentId).AssumeNotNull(); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs index b1e98de72f2..762211b554a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs @@ -17,8 +17,9 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; public class CohostFoldingRangeEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) { - [Fact] - public Task IfStatements() + [Theory] + [CombinatorialData] + public Task IfStatements(bool miscellaneousFile) => VerifyFoldingRangesAsync("""
@if (true) {[| @@ -36,7 +37,8 @@ Hello World |] @if (true) {[| }|] - """); + """, + miscellaneousFile: miscellaneousFile); [Fact] public Task LockStatement() @@ -213,10 +215,10 @@ public void M() {[| }|] """); - private async Task VerifyFoldingRangesAsync(string input, RazorFileKind? fileKind = null) + private async Task VerifyFoldingRangesAsync(string input, RazorFileKind? fileKind = null, bool miscellaneousFile = false) { TestFileMarkupParser.GetSpans(input, out var source, out ImmutableDictionary> spans); - var document = CreateProjectAndRazorDocument(source, fileKind); + var document = CreateProjectAndRazorDocument(source, fileKind, miscellaneousFile: miscellaneousFile); var inputText = await document.GetTextAsync(DisposalToken); var htmlSpans = spans.GetValueOrDefault("html").NullToEmpty(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs index 590e3f49ac6..94dd6c071ca 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs @@ -418,7 +418,7 @@ private async Task VerifyGoToDefinitionAsync( SumType? htmlResponse = null, params (string fileName, string contents)[]? additionalFiles) { - var document = CreateProjectAndRazorDocument(input.Text, fileKind, additionalFiles); + var document = CreateProjectAndRazorDocument(input.Text, fileKind, additionalFiles: additionalFiles); return await GetGoToDefinitionResultCoreAsync(document, input, htmlResponse); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs index 6bbcacaa507..9a00ef5b74c 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs @@ -174,7 +174,7 @@ private async Task VerifyRenamesAsync( (string oldName, string newName)[]? renames = null) { TestFileMarkupParser.GetPosition(input, out var source, out var cursorPosition); - var document = CreateProjectAndRazorDocument(source, fileKind, additionalFiles); + var document = CreateProjectAndRazorDocument(source, fileKind, additionalFiles: additionalFiles); var inputText = await document.GetTextAsync(DisposalToken); var position = inputText.GetPosition(cursorPosition); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs index 7ef6a2c3dd2..3320f57dc28 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs @@ -22,7 +22,7 @@ public class CohostSemanticTokensRangeEndpointTest(ITestOutputHelper testOutputH { [Theory] [CombinatorialData] - public async Task Razor(bool colorBackground, bool precise, bool supportsVSExtensions) + public async Task Razor(bool colorBackground, bool precise, bool supportsVSExtensions, bool miscellaneousFile) { var input = """ @page "/" @@ -63,12 +63,12 @@ public void M() } """; - await VerifySemanticTokensAsync(input, colorBackground, precise, supportsVSExtensions); + await VerifySemanticTokensAsync(input, colorBackground, precise, supportsVSExtensions, miscellaneousFile); } [Theory] [CombinatorialData] - public async Task Legacy(bool colorBackground, bool precise, bool supportsVSExtensions) + public async Task Legacy(bool colorBackground, bool precise, bool supportsVSExtensions, bool miscellaneousFile) { var input = """ @page "/" @@ -91,12 +91,12 @@ @section MySection { } """; - await VerifySemanticTokensAsync(input, colorBackground, precise, supportsVSExtensions, fileKind: RazorFileKind.Legacy); + await VerifySemanticTokensAsync(input, colorBackground, precise, supportsVSExtensions, miscellaneousFile, fileKind: RazorFileKind.Legacy); } [Theory] [CombinatorialData] - public async Task Legacy_Compatibility(bool colorBackground, bool precise, bool supportsVSExtensions) + public async Task Legacy_Compatibility(bool colorBackground, bool precise, bool supportsVSExtensions, bool miscellaneousFile) { // Same test as above, but with only the things that work in FUSE and non-FUSE, to prevent regressions @@ -116,7 +116,7 @@ public void M() } """; - await VerifySemanticTokensAsync(input, colorBackground, precise, supportsVSExtensions, fileKind: RazorFileKind.Legacy); + await VerifySemanticTokensAsync(input, colorBackground, precise, supportsVSExtensions, miscellaneousFile, fileKind: RazorFileKind.Legacy); } private async Task VerifySemanticTokensAsync( @@ -124,10 +124,11 @@ private async Task VerifySemanticTokensAsync( bool colorBackground, bool precise, bool supportsVSExtensions, + bool miscellaneousFile, RazorFileKind? fileKind = null, [CallerMemberName] string? testName = null) { - var document = CreateProjectAndRazorDocument(input, fileKind); + var document = CreateProjectAndRazorDocument(input, fileKind, miscellaneousFile: miscellaneousFile); var sourceText = await document.GetTextAsync(DisposalToken); var legend = TestRazorSemanticTokensLegendService.GetInstance(supportsVSExtensions); @@ -168,6 +169,11 @@ private async Task VerifySemanticTokensAsync( testName += "_with_background"; } + if (miscellaneousFile) + { + testName += "_misc_file"; + } + var baselineFileName = $@"TestFiles\SemanticTokens\{testName}.txt"; if (GenerateBaselines.ShouldGenerate) { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/DefinitionServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/DefinitionServiceTest.cs index ea3dfc98d62..86d50a52409 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/DefinitionServiceTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/DefinitionServiceTest.cs @@ -61,7 +61,7 @@ await VerifyDefinitionAsync(input, surveyPrompt, private async Task VerifyDefinitionAsync(TestCode input, TestCode expectedDocument, params (string fileName, string contents)[]? additionalFiles) { - var document = CreateProjectAndRazorDocument(input.Text, RazorFileKind.Component, additionalFiles); + var document = CreateProjectAndRazorDocument(input.Text, RazorFileKind.Component, additionalFiles: additionalFiles); var service = OOPExportProvider.GetExportedValue(); var snapshotManager = OOPExportProvider.GetExportedValue(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestIncompatibleProjectService.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestIncompatibleProjectService.cs index a80cbce506e..caaa30ebcc5 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestIncompatibleProjectService.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestIncompatibleProjectService.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel.Composition; -using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; using Microsoft.CodeAnalysis.Razor.Cohost; using Xunit; @@ -12,11 +11,6 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; [Export(typeof(IIncompatibleProjectService)), PartNotDiscoverable] internal class TestIncompatibleProjectService() : IIncompatibleProjectService { - public void HandleMiscFilesDocument(TextDocument textDocument) - { - Assert.Fail($"Incorrect test setup? No FilePath for the project that {textDocument.Id} is in"); - } - public void HandleMissingDocument(RazorTextDocumentIdentifier? textDocumentIdentifier, RazorCohostRequestContext context) { Assert.Fail($"Incorrect test setup? No TextDocument for {textDocumentIdentifier} was found"); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_VSCode_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_VSCode_misc_file.txt new file mode 100644 index 00000000000..6b51ba8aba8 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_VSCode_misc_file.txt @@ -0,0 +1,39 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_VSCode_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_VSCode_with_background_misc_file.txt new file mode 100644 index 00000000000..83f2aacb9ef --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_VSCode_with_background_misc_file.txt @@ -0,0 +1,45 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [razorCode] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_misc_file.txt new file mode 100644 index 00000000000..6966a68a5ba --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_misc_file.txt @@ -0,0 +1,39 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method name [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_with_background_misc_file.txt new file mode 100644 index 00000000000..a3ec4b31b7f --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_Compatibility_with_background_misc_file.txt @@ -0,0 +1,45 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [razorCode] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method name [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_VSCode_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_VSCode_misc_file.txt new file mode 100644 index 00000000000..53e3acf8205 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_VSCode_misc_file.txt @@ -0,0 +1,55 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 8 variable [] [AppThing] +0 8 1 operator [] [.] +0 1 5 variable [] [Model] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] +2 0 1 razorTransition [] [@] +0 1 7 razorDirective [] [section] +0 18 1 razorTransition [] [{] +1 4 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 16 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_VSCode_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_VSCode_with_background_misc_file.txt new file mode 100644 index 00000000000..e00c0d67b47 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_VSCode_with_background_misc_file.txt @@ -0,0 +1,61 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [razorCode] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 8 variable [razorCode] [AppThing] +0 8 1 operator [razorCode] [.] +0 1 5 variable [razorCode] [Model] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] +2 0 1 razorTransition [] [@] +0 1 7 razorDirective [] [section] +0 18 1 razorTransition [] [{] +1 4 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 16 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_misc_file.txt new file mode 100644 index 00000000000..94a3fafe00c --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_misc_file.txt @@ -0,0 +1,55 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 8 variable [] [AppThing] +0 8 1 operator [] [.] +0 1 5 variable [] [Model] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method name [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] +2 0 1 razorTransition [] [@] +0 1 7 razorDirective [] [section] +0 18 1 razorTransition [] [{] +1 4 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 16 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_with_background_misc_file.txt new file mode 100644 index 00000000000..14185d5af45 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Legacy_with_background_misc_file.txt @@ -0,0 +1,61 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [razorCode] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 8 variable [razorCode] [AppThing] +0 8 1 operator [razorCode] [.] +0 1 5 variable [razorCode] [Model] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [component] +0 10 4 markupAttribute [] [type] +0 4 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [typeof(Component)] +0 17 1 markupAttributeQuote [] ["] +0 2 11 markupAttribute [] [render-mode] +0 11 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 17 markupAttributeValue [] [ServerPrerendered] +0 17 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method name [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] +2 0 1 razorTransition [] [@] +0 1 7 razorDirective [] [section] +0 18 1 razorTransition [] [{] +1 4 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 16 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_VSCode_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_VSCode_misc_file.txt new file mode 100644 index 00000000000..6e69bca3bef --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_VSCode_misc_file.txt @@ -0,0 +1,87 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +0 6 1 operator [] [.] +0 1 11 namespace [] [Diagnostics] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [InputText] +0 10 5 markupAttribute [] [Value] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 9 markupAttributeValue [] [someValue] +0 9 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 13 razorComment [] [ hello there ] +0 13 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] +1 0 4 markupCommentPunctuation [] [] +2 0 1 razorTransition [] [@] +0 1 2 controlKeyword [] [if] +0 3 1 punctuation [] [(] +0 1 4 keyword [] [true] +0 4 1 punctuation [] [)] +1 0 1 punctuation [] [{] +1 4 6 razorDirective [] [] +0 11 7 razorDirective [] [] +1 0 1 punctuation [] [}] +2 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 1 punctuation [] [[] +0 1 15 class [] [DebuggerDisplay] +0 15 1 punctuation [] [(] +0 1 25 string [] ["{GetDebuggerDisplay,nq}"] +0 25 1 punctuation [] [)] +0 1 1 punctuation [] []] +1 4 6 keyword [] [public] +0 7 5 keyword [] [class] +0 6 7 class [] [MyClass] +1 4 1 punctuation [] [{] +1 4 1 punctuation [] [}] +2 4 36 comment [] [// I am also good, thanks for asking] +2 4 2 comment [] [/*] +1 0 19 comment [] [ No problem.] +1 0 6 comment [] [ */] +2 4 7 keyword [] [private] +0 8 6 keyword [] [string] +0 7 9 field [] [someValue] +0 9 1 punctuation [] [;] +2 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 14 variable [] [RenderFragment] +0 15 1 variable [] [x] +0 2 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 39 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_VSCode_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_VSCode_with_background_misc_file.txt new file mode 100644 index 00000000000..288b8c1c9d4 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_VSCode_with_background_misc_file.txt @@ -0,0 +1,109 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [razorCode] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +0 6 1 operator [razorCode] [.] +0 1 11 namespace [razorCode] [Diagnostics] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [InputText] +0 10 5 markupAttribute [] [Value] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 9 markupAttributeValue [] [someValue] +0 9 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 13 razorComment [] [ hello there ] +0 13 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] +1 0 4 markupCommentPunctuation [] [] +2 0 1 razorTransition [razorCode] [@] +0 1 2 controlKeyword [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 4 keyword [razorCode] [true] +0 4 1 punctuation [razorCode] [)] +1 0 1 punctuation [razorCode] [{] +1 4 6 razorDirective [] [] +0 11 7 razorDirective [] [] +1 0 1 punctuation [razorCode] [}] +2 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [[] +0 1 15 class [razorCode] [DebuggerDisplay] +0 15 1 punctuation [razorCode] [(] +0 1 25 string [razorCode] ["{GetDebuggerDisplay,nq}"] +0 25 1 punctuation [razorCode] [)] +0 1 1 punctuation [razorCode] []] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 5 keyword [razorCode] [class] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 7 class [razorCode] [MyClass] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 36 comment [razorCode] [// I am also good, thanks for asking] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 2 comment [razorCode] [/*] +1 0 19 comment [razorCode] [ No problem.] +1 0 6 comment [razorCode] [ */] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 6 keyword [razorCode] [string] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 9 field [razorCode] [someValue] +0 9 1 punctuation [razorCode] [;] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 14 variable [razorCode] [RenderFragment] +0 14 1 markupTextLiteral [razorCode] [ ] +0 1 1 variable [razorCode] [x] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 39 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_misc_file.txt new file mode 100644 index 00000000000..9c625ac951d --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_misc_file.txt @@ -0,0 +1,87 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +0 6 1 operator [] [.] +0 1 11 namespace name [] [Diagnostics] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [InputText] +0 10 5 markupAttribute [] [Value] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 9 markupAttributeValue [] [someValue] +0 9 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 13 razorComment [] [ hello there ] +0 13 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] +1 0 4 markupCommentPunctuation [] [] +2 0 1 razorTransition [] [@] +0 1 2 keyword - control [] [if] +0 3 1 punctuation [] [(] +0 1 4 keyword [] [true] +0 4 1 punctuation [] [)] +1 0 1 punctuation [] [{] +1 4 6 razorDirective [] [] +0 11 7 razorDirective [] [] +1 0 1 punctuation [] [}] +2 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 1 punctuation [] [[] +0 1 15 class name [] [DebuggerDisplay] +0 15 1 punctuation [] [(] +0 1 25 string [] ["{GetDebuggerDisplay,nq}"] +0 25 1 punctuation [] [)] +0 1 1 punctuation [] []] +1 4 6 keyword [] [public] +0 7 5 keyword [] [class] +0 6 7 class name [] [MyClass] +1 4 1 punctuation [] [{] +1 4 1 punctuation [] [}] +2 4 36 comment [] [// I am also good, thanks for asking] +2 4 2 comment [] [/*] +1 0 19 comment [] [ No problem.] +1 0 6 comment [] [ */] +2 4 7 keyword [] [private] +0 8 6 keyword [] [string] +0 7 9 field name [] [someValue] +0 9 1 punctuation [] [;] +2 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method name [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 14 variable [] [RenderFragment] +0 15 1 local name [] [x] +0 2 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 39 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_with_background_misc_file.txt new file mode 100644 index 00000000000..e3f934e61f3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Razor_with_background_misc_file.txt @@ -0,0 +1,109 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [page] +0 5 3 string [razorCode] ["/"] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +0 6 1 operator [razorCode] [.] +0 1 11 namespace name [razorCode] [Diagnostics] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 0 1 markupTagDelimiter [] [<] +0 1 9 markupElement [] [InputText] +0 10 5 markupAttribute [] [Value] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 9 markupAttributeValue [] [someValue] +0 9 1 markupAttributeQuote [] ["] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +2 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 13 razorComment [] [ hello there ] +0 13 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] +1 0 4 markupCommentPunctuation [] [] +2 0 1 razorTransition [razorCode] [@] +0 1 2 keyword - control [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 4 keyword [razorCode] [true] +0 4 1 punctuation [razorCode] [)] +1 0 1 punctuation [razorCode] [{] +1 4 6 razorDirective [] [] +0 11 7 razorDirective [] [] +1 0 1 punctuation [razorCode] [}] +2 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [[] +0 1 15 class name [razorCode] [DebuggerDisplay] +0 15 1 punctuation [razorCode] [(] +0 1 25 string [razorCode] ["{GetDebuggerDisplay,nq}"] +0 25 1 punctuation [razorCode] [)] +0 1 1 punctuation [razorCode] []] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 5 keyword [razorCode] [class] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 7 class name [razorCode] [MyClass] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 36 comment [razorCode] [// I am also good, thanks for asking] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 2 comment [razorCode] [/*] +1 0 19 comment [razorCode] [ No problem.] +1 0 6 comment [razorCode] [ */] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 6 keyword [razorCode] [string] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 9 field name [razorCode] [someValue] +0 9 1 punctuation [razorCode] [;] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method name [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 14 variable [razorCode] [RenderFragment] +0 14 1 markupTextLiteral [razorCode] [ ] +0 1 1 local name [razorCode] [x] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 39 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}]