7 instantiations of RazorSourceDocument
Microsoft.CodeAnalysis.Razor.Compiler (7)
Language\RazorSourceDocument.cs (7)
67
return new
RazorSourceDocument
(sourceText, properties);
91
return new
RazorSourceDocument
(sourceText, properties);
119
return new
RazorSourceDocument
(sourceText, properties);
154
return new
RazorSourceDocument
(sourceText, RazorSourceDocumentProperties.Create(filePath, relativePath));
219
return new
RazorSourceDocument
(sourceText, properties);
247
return new
RazorSourceDocument
(sourceText, properties);
268
return new
RazorSourceDocument
(text, properties);
466 references to RazorSourceDocument
Microsoft.AspNetCore.Mvc.Razor.Extensions.UnitTests (20)
ConsolidatedMvcViewDocumentClassifierPassTest.cs (3)
41
var
source = TestRazorSourceDocument.Create("some-content", filePath: "ignored", relativePath: "Test.cshtml");
64
var
source = TestRazorSourceDocument.Create("some-content", filePath: null, relativePath: null);
89
var
source = TestRazorSourceDocument.Create("some-content", filePath: "ignored", relativePath: relativePath);
CreateNewOnMetadataUpdateAttributePassTest.cs (2)
29
var
source = TestRazorSourceDocument.Create("Hello world", filePath: "ignored", relativePath: "Test.cshtml");
59
var
source = TestRazorSourceDocument.Create("Hello world", filePath: "ignored", relativePath: "Test.razor");
MvcViewDocumentClassifierPassTest.cs (5)
73
var
source = TestRazorSourceDocument.Create("some-content", filePath: "ignored", relativePath: "Test.cshtml");
96
var
source = TestRazorSourceDocument.Create("some-content", filePath: null, relativePath: null);
121
var
source = TestRazorSourceDocument.Create("some-content", filePath: "ignored", relativePath: relativePath);
139
var
source = TestRazorSourceDocument.Create("some-content", filePath: @"x::\application\Views\Home\Index.cshtml", relativePath: null);
157
var
source = TestRazorSourceDocument.Create("@page", filePath: @"x:\Test.cshtml", relativePath: "path.with+invalid-chars");
PageDirectiveTest.cs (2)
43
var
importSource =
RazorSourceDocument
.Create("@page", "import.cshtml");
RazorPageDocumentClassifierPassTest.cs (8)
42
var
source = TestRazorSourceDocument.Create("<p>Hello World</p>", filePath: "main.cshtml");
43
var
importSource = TestRazorSourceDocument.Create("@page", filePath: "import.cshtml");
189
var
source = TestRazorSourceDocument.Create("@page", filePath: "ignored", relativePath: "Test.cshtml");
209
var
source = TestRazorSourceDocument.Create("@page", filePath: null, relativePath: null);
231
var
source = TestRazorSourceDocument.Create("@page", filePath: "ignored", relativePath: relativePath);
249
var
source = TestRazorSourceDocument.Create("@page", filePath: @"x::\application\Views\Home\Index.cshtml", relativePath: null);
267
var
source = TestRazorSourceDocument.Create("@page", filePath: @"x:\Test.cshtml", relativePath: "path.with+invalid-chars");
304
var
source = TestRazorSourceDocument.Create("@page \"some-route\"", filePath: "ignored", relativePath: "Test.cshtml");
Microsoft.AspNetCore.Razor.Language.UnitTests (179)
CodeGeneration\DesignTimeNodeWriterTest.cs (4)
376
var
source = TestRazorSourceDocument.Create(content);
408
var
sourceDocument = TestRazorSourceDocument.Create(content);
440
var
source = TestRazorSourceDocument.Create(content);
532
using var context = TestCodeRenderingContext.CreateDesignTime(source:
RazorSourceDocument
.Create("", fileName));
CodeGeneration\RuntimeNodeWriterTest.cs (4)
476
var
source = TestRazorSourceDocument.Create(content);
505
var
source = TestRazorSourceDocument.Create(content);
531
var
source = TestRazorSourceDocument.Create(content);
566
var
source = TestRazorSourceDocument.Create(content);
CodeGeneration\TagHelperHtmlAttributeRuntimeNodeWriterTest.cs (3)
26
var
source = TestRazorSourceDocument.Create(content);
51
var
source = TestRazorSourceDocument.Create(content);
85
var
source = TestRazorSourceDocument.Create(content);
Components\ComponentDocumentClassifierPassTest.cs (6)
22
var
source = TestRazorSourceDocument.Create("some-content", filePath: "Test.razor");
44
var
source = TestRazorSourceDocument.Create("some-content", filePath: "/MyApp/Test.razor", relativePath: "Test.razor");
67
var
source = TestRazorSourceDocument.Create("some-content", filePath: "/MyApp/Test.razor", relativePath: "Test.razor");
93
var
source = TestRazorSourceDocument.Create("some-content", filePath: $"/MyApp{relativePath}", relativePath: relativePath);
118
var
source = TestRazorSourceDocument.Create("some-content", filePath: @"x:\My.+App\path.with+invalid-chars.razor", relativePath: "path.with+invalid-chars.razor");
138
var
source = TestRazorSourceDocument.Create("some-content", filePath: "Test.razor");
Components\ComponentDuplicateAttributeDiagnosticPassTest.cs (2)
164
var
source =
RazorSourceDocument
.Create(content, "test.cshtml");
Components\ComponentMarkupBlockPassTest.cs (2)
452
var
source =
RazorSourceDocument
.Create(content, "test.cshtml");
Components\ComponentMarkupEncodingPassTest.cs (2)
210
var
source =
RazorSourceDocument
.Create(content, "test.cshtml");
Components\ComponentWhitespacePassTest.cs (2)
165
var
source =
RazorSourceDocument
.Create(content, "test.cshtml");
DefaultRazorCSharpLoweringPhaseTest.cs (4)
122
var
source =
RazorSourceDocument
.Create(sourceText, RazorSourceDocumentProperties.Create("test.cshtml", null));
154
var
source =
RazorSourceDocument
.Create(sourceText, RazorSourceDocumentProperties.Create("test.cshtml", null));
DefaultRazorIntermediateNodeLoweringPhaseIntegrationTest.cs (10)
367
var
source = TestRazorSourceDocument.Create(@"@using System.Threading.Tasks
369
var
importSource1 = TestRazorSourceDocument.Create("@using System.Globalization");
370
var
importSource2 = TestRazorSourceDocument.Create("@using System.Text");
390
var
source = TestRazorSourceDocument.Create(@"@using System.Threading.Tasks
392
var
importSource = TestRazorSourceDocument.Create("@using System.Threading.Tasks");
424
var
source = TestRazorSourceDocument.Create("<p>Hi!</p>");
425
var
importSource1 = TestRazorSourceDocument.Create("@test value1");
426
var
importSource2 = TestRazorSourceDocument.Create("@test value2");
451
var
source = TestRazorSourceDocument.Create("<p>Hi!</p>");
452
var
importSource = TestRazorSourceDocument.Create("@block token { }");
DefaultRazorIntermediateNodeLoweringPhaseTest.cs (7)
36
var
importSource = TestRazorSourceDocument.Create("@custom \"hello\"", filePath: "import.cshtml");
74
var
importSource = TestRazorSourceDocument.Create("@custom \"hello\"", filePath: "import.cshtml");
112
var
importSource1 = TestRazorSourceDocument.Create("@custom \"hello\"", filePath: "import1.cshtml");
113
var
importSource2 = TestRazorSourceDocument.Create("@custom \"world\"", filePath: "import2.cshtml");
147
var
importSource = TestRazorSourceDocument.Create(
180
var
importSource = TestRazorSourceDocument.Create("@custom { }", filePath: "import.cshtml");
213
var
importSource = TestRazorSourceDocument.Create("@custom { }", filePath: "import.cshtml");
DefaultRazorParsingPhaseTest.cs (1)
66
var
source = TestRazorSourceDocument.Create();
DefaultRazorProjectEngineIntegrationTest.cs (10)
73
var
import = Assert.Single(codeDocument.Imports);
126
var expectedImports = ImmutableArray.Create(
RazorSourceDocument
.ReadFrom(importItem));
136
var codeDocument = projectEngine.Process(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, expectedImports, expectedTagHelpers);
153
var codeDocument = projectEngine.Process(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, importSources: default, tagHelpers: null);
169
var codeDocument = projectEngine.Process(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, importSources: default, tagHelpers: null);
233
var codeDocument = projectEngine.Process(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, importSources: default, tagHelpers: null);
245
var expectedImports = ImmutableArray.Create(
RazorSourceDocument
.ReadFrom(importItem));
255
var codeDocument = projectEngine.ProcessDesignTime(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, expectedImports, expectedTagHelpers);
272
var codeDocument = projectEngine.ProcessDesignTime(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, default, tagHelpers: null);
336
var codeDocument = projectEngine.ProcessDesignTime(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, importSources: default, tagHelpers: null);
DefaultRazorTagHelperBinderPhaseTest.cs (29)
37
var
source = TestRazorSourceDocument.Create(content, filePath: null);
66
var
source = TestRazorSourceDocument.Create(content, filePath: null);
95
var
source = TestRazorSourceDocument.Create(content, filePath: null);
128
var
source = CreateTestSourceDocument();
161
var
sourceDocument = CreateTestSourceDocument();
200
var
source = CreateTestSourceDocument();
239
var
source = CreateTestSourceDocument();
281
var
source = TestRazorSourceDocument.Create(content);
324
var
source = TestRazorSourceDocument.Create(content);
358
var
source = CreateTestSourceDocument();
388
var
source = CreateTestSourceDocument();
408
var
source = TestRazorSourceDocument.Create("Hello, world");
432
var
source = TestRazorSourceDocument.Create("Hello, world");
471
var
source = TestRazorSourceDocument.Create(content, filePath: null);
601
var
sourceDocument = TestRazorSourceDocument.Create(source, filePath: "TestFile");
752
var
sourceDocument = TestRazorSourceDocument.Create(source, filePath: "TestFile");
855
var
sourceDocument = TestRazorSourceDocument.Create(source, filePath: "TestFile");
883
var
sourceDocument = CreateTestSourceDocument();
895
private static
RazorSourceDocument
CreateTestSourceDocument()
933
var
sourceDocument = CreateComponentTestSourceDocument(@"<Counter />", "C:\\SomeFolder\\SomeProject\\Counter.cshtml");
965
var
sourceDocument = CreateComponentTestSourceDocument(content, filePath);
1000
var
sourceDocument = CreateComponentTestSourceDocument(content, filePath);
1038
var
sourceDocument = CreateComponentTestSourceDocument(content, filePath);
1073
var
sourceDocument = CreateComponentTestSourceDocument(content, filePath);
1109
var
sourceDocument = CreateComponentTestSourceDocument(content, filePath);
1139
var
sourceDocument = CreateComponentTestSourceDocument(content, filePath);
1176
var
sourceDocument = CreateComponentTestSourceDocument(content, filePath);
1228
private static
RazorSourceDocument
CreateComponentTestSourceDocument(string content, string filePath = null)
1230
var
sourceDocument = TestRazorSourceDocument.Create(content, filePath: filePath);
DirectiveRemovalOptimizationPassTest.cs (3)
31
var
source = TestRazorSourceDocument.Create(content);
61
var
source = TestRazorSourceDocument.Create(content);
89
var
source = TestRazorSourceDocument.Create(content);
Extensions\DefaultMetadataIdentifierFeatureTest.cs (3)
21
var
source = TestRazorSourceDocument.Create("content", filePath: "Test.cshtml", relativePath: null);
37
var
source = TestRazorSourceDocument.Create("content", filePath: "Test.cshtml", relativePath: string.Empty);
58
var
sourceDocument = TestRazorSourceDocument.Create("content", filePath: "Test.cshtml", relativePath: relativePath);
Extensions\FunctionsDirectivePassTest.cs (4)
24
var
source = TestRazorSourceDocument.Create("@functions { var value = true; }");
43
var
source = TestRazorSourceDocument.Create("@functions { var value = true; }");
81
var
source = TestRazorSourceDocument.Create("@code { var value = true; }");
119
var
source = TestRazorSourceDocument.Create(@"
Extensions\MetadataAttributePassTest.cs (12)
24
var
source = TestRazorSourceDocument.Create();
47
var
source = TestRazorSourceDocument.Create();
74
var
source = TestRazorSourceDocument.Create();
94
var
source = TestRazorSourceDocument.Create();
143
var
source = TestRazorSourceDocument.Create();
179
var
source = TestRazorSourceDocument.Create();
212
var
source = TestRazorSourceDocument.Create("", RazorSourceDocumentProperties.Default);
249
var
source = TestRazorSourceDocument.Create("", RazorSourceDocumentProperties.Create(null, "Foo\\Bar.cshtml"));
296
var
source = TestRazorSourceDocument.Create("", RazorSourceDocumentProperties.Create(null, "Foo\\Bar.cshtml"));
297
var
importSource = TestRazorSourceDocument.Create("@using System", RazorSourceDocumentProperties.Create(null, "Foo\\Import.cshtml"));
356
var
source = TestRazorSourceDocument.Create("", RazorSourceDocumentProperties.Create(null, "Foo\\Bar.cshtml"));
357
var
importSource = TestRazorSourceDocument.Create("@using System", RazorSourceDocumentProperties.Create(null, "Foo\\Import.cshtml"));
Extensions\SectionDirectivePassTest.cs (4)
30
var
source = TestRazorSourceDocument.Create("@section Header { <p>Hello World</p> }");
50
var
source = TestRazorSourceDocument.Create(content);
87
var
source = TestRazorSourceDocument.Create(content, filePath: "test.cshtml", relativePath: "test.cshtml");
112
var
source = TestRazorSourceDocument.Create(content, filePath: "test.razor", relativePath: "test.razor");
HtmlNodeOptimizationPassTest.cs (1)
30
var
source = TestRazorSourceDocument.Create(content);
IntegrationTests\CodeGenerationIntegrationTest.cs (5)
396
var codeDocument = projectEngine.Process(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, imports, tagHelpers);
415
var codeDocument = projectEngine.ProcessDesignTime(
RazorSourceDocument
.ReadFrom(projectItem), RazorFileKind.Legacy, imports, tagHelpers);
425
private static ImmutableArray<
RazorSourceDocument
> GetImports(RazorProjectEngine projectEngine, RazorProjectItem projectItem)
427
using var result = new PooledArrayBuilder<
RazorSourceDocument
>();
431
result.Add(
RazorSourceDocument
.ReadFrom(import));
Legacy\CSharpCodeParserTest.cs (2)
196
var
source = TestRazorSourceDocument.Create(
215
var
source = TestRazorSourceDocument.Create();
Legacy\HtmlMarkupParserTests.cs (1)
229
var
source = TestRazorSourceDocument.Create(content);
Legacy\RazorParserTest.cs (1)
17
var
sourceDocument = TestRazorSourceDocument.CreateResource("TestFiles/Source/BasicMarkup.cshtml", GetType());
Legacy\TokenizerLookaheadTest.cs (1)
132
var
source = TestRazorSourceDocument.Create(content);
RazorCodeDocumentExtensionsTest.cs (24)
136
var
source = TestRazorSourceDocument.Create("@using A", filePath: filePath, relativePath: filePath);
155
var
source = TestRazorSourceDocument.Create(filePath: "C:\\Hello\\Test.cshtml", relativePath: "Test.cshtml");
171
var
source = TestRazorSourceDocument.Create(filePath: "C:\\Hello\\Test.cshtml", relativePath: null);
187
var
source = TestRazorSourceDocument.Create(filePath: null, relativePath: "Test.cshtml");
203
var
source = TestRazorSourceDocument.Create(
222
var
source = TestRazorSourceDocument.Create(
241
var
source = TestRazorSourceDocument.Create(
260
var
source = TestRazorSourceDocument.Create(
279
var
source = TestRazorSourceDocument.Create(
305
var
source = TestRazorSourceDocument.Create(
319
var
importSource = TestRazorSourceDocument.Create(
338
var
source = TestRazorSourceDocument.Create(
351
var
importSource = TestRazorSourceDocument.Create(
370
var
source = TestRazorSourceDocument.Create(
384
var
importSource = TestRazorSourceDocument.Create(
403
var
source = TestRazorSourceDocument.Create(
417
var
importSource = TestRazorSourceDocument.Create(
436
var
source = TestRazorSourceDocument.Create(
449
var
importSource1 = TestRazorSourceDocument.Create(
456
var
importSource2 = TestRazorSourceDocument.Create(
486
var
source = TestRazorSourceDocument.Create(
497
var
importSource = TestRazorSourceDocument.Create(
516
var
source = TestRazorSourceDocument.Create(
526
var
importSource = TestRazorSourceDocument.Create(
RazorProjectEngineTest.cs (1)
136
var
sourceDocument = Assert.Single(sourceDocuments);
RazorSourceDocumentTest.cs (27)
20
var
document =
RazorSourceDocument
.ReadFrom(content, "file.cshtml");
34
var
document =
RazorSourceDocument
.ReadFrom(content, "file.cshtml", Encoding.UTF32);
49
var
document =
RazorSourceDocument
.ReadFrom(content, Encoding.UTF32, properties);
64
var
document =
RazorSourceDocument
.ReadFrom(content, "file.cshtml", Encoding.UTF32);
78
var
document =
RazorSourceDocument
.ReadFrom(projectItem);
93
var
document =
RazorSourceDocument
.ReadFrom(projectItem);
108
var
document =
RazorSourceDocument
.ReadFrom(projectItem);
123
var
document =
RazorSourceDocument
.ReadFrom(projectItem);
139
var
document =
RazorSourceDocument
.Create(content, fileName);
156
var
document =
RazorSourceDocument
.Create(content, fileName, encoding);
172
var
document =
RazorSourceDocument
.Create(content, Encoding.UTF32, properties);
189
var
document =
RazorSourceDocument
.ReadFrom(projectItem);
205
var
document =
RazorSourceDocument
.ReadFrom(projectItem);
212
private static string ReadContent(
RazorSourceDocument
razorSourceDocument) => razorSourceDocument.Text.ToString();
RazorSyntaxTreeTest.cs (3)
18
var
source = TestRazorSourceDocument.Create(string.Empty);
33
var
source = TestRazorSourceDocument.Create("@if (true) { @if(false) { <div>@something.</div> } }", filePath: filePath);
50
var
source = TestRazorSourceDocument.Create("\r\n \r\n @*SomeComment*@ \r\n @tagHelperPrefix \"SomePrefix\"\r\n<html>\r\n@if (true) {\r\n @if(false) { <div>@something.</div> } \r\n}");
Syntax\FindTokenTests.cs (1)
30
return RazorSyntaxTree.Parse(
RazorSourceDocument
.Create(text, System.Text.Encoding.Default, RazorSourceDocumentProperties.Default));
Microsoft.AspNetCore.Razor.Microbenchmarks (2)
Serialization\CompletionListSerializationBenchmark.cs (2)
66
var
sourceDocument =
RazorSourceDocument
.Create(documentContent, RazorSourceDocumentProperties.Default);
Microsoft.AspNetCore.Razor.Microbenchmarks.Compiler (2)
SyntaxTreeGenerationBenckmark.cs (2)
32
MSN =
RazorSourceDocument
.ReadFrom(projectItem);
40
public
RazorSourceDocument
MSN { get; }
Microsoft.AspNetCore.Razor.Test.Common (37)
Language\CodeGeneration\TestCodeRenderingContext.cs (2)
15
RazorSourceDocument
source = null,
33
RazorSourceDocument
source = null,
Language\IntegrationTests\SourceMappingsSerializer.cs (1)
16
internal static string Serialize(RazorCSharpDocument csharpDocument,
RazorSourceDocument
sourceDocument)
Language\Legacy\ParserTestBase.cs (1)
215
var
source = TestRazorSourceDocument.Create(document, filePath: null, relativePath: null, normalizeNewLines: true);
Language\RazorProjectEngineExtensions.cs (22)
23
ImmutableArray<
RazorSourceDocument
> importSources)
29
ImmutableArray<
RazorSourceDocument
> importSources)
45
ImmutableArray<
RazorSourceDocument
> importSources,
52
ImmutableArray<
RazorSourceDocument
> importSources,
59
ImmutableArray<
RazorSourceDocument
> importSources = default,
71
ImmutableArray<
RazorSourceDocument
> importSources)
77
ImmutableArray<
RazorSourceDocument
> importSources)
93
ImmutableArray<
RazorSourceDocument
> importSources,
100
ImmutableArray<
RazorSourceDocument
> importSources,
107
ImmutableArray<
RazorSourceDocument
> importSources = default,
120
ImmutableArray<
RazorSourceDocument
> importSources)
127
ImmutableArray<
RazorSourceDocument
> importSources)
146
ImmutableArray<
RazorSourceDocument
> importSources,
154
ImmutableArray<
RazorSourceDocument
> importSources,
162
ImmutableArray<
RazorSourceDocument
> importSources = default,
165
var
source = TestRazorSourceDocument.Create(content);
192
ImmutableArray<
RazorSourceDocument
> importSources)
198
ImmutableArray<
RazorSourceDocument
> importSources,
206
ImmutableArray<
RazorSourceDocument
> importSources)
213
ImmutableArray<
RazorSourceDocument
> importSources,
221
ImmutableArray<
RazorSourceDocument
> importSources = default,
224
var
source = TestRazorSourceDocument.Create(content);
Language\SyntaxTreeVerifier.cs (2)
115
private readonly
RazorSourceDocument
_source;
121
public Verifier(
RazorSourceDocument
source)
Language\TestRazorSourceDocument.cs (9)
16
public static
RazorSourceDocument
CreateResource(string resourcePath, Type type, Encoding encoding = null, bool normalizeNewLines = false)
21
public static
RazorSourceDocument
CreateResource(string resourcePath, Assembly assembly, Encoding encoding = null, bool normalizeNewLines = false)
35
return
RazorSourceDocument
.Create(content, encoding ?? Encoding.UTF8, properties);
39
public static
RazorSourceDocument
CreateResource(
57
return
RazorSourceDocument
.Create(content, encoding ?? Encoding.UTF8, properties);
80
public static
RazorSourceDocument
Create(
93
return
RazorSourceDocument
.Create(content, encoding ?? Encoding.UTF8, properties);
96
public static
RazorSourceDocument
Create(
107
return
RazorSourceDocument
.Create(content, encoding ?? Encoding.UTF8, properties);
Microsoft.AspNetCore.Razor.Test.Common.Tooling (1)
RazorCodeDocumentFactory.cs (1)
26
var
sourceDocument = TestRazorSourceDocument.Create(text, filePath: filePath, relativePath: filePath);
Microsoft.CodeAnalysis.Razor.Compiler (171)
Language\CodeGeneration\CodeRenderingContext.cs (2)
16
public
RazorSourceDocument
SourceDocument { get; }
36
RazorSourceDocument
sourceDocument,
Language\DefaultImportProjectItem.cs (2)
13
private
RazorSourceDocument
? _source;
24
internal override
RazorSourceDocument
GetSource()
Language\DefaultRazorCSharpLoweringPhase.cs (1)
108
var
sourceDocument = _context.SourceDocument;
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (1)
331
public
RazorSourceDocument
SourceDocument { get; set; }
Language\DefaultRazorParsingPhase.cs (3)
13
private static readonly ConditionalWeakTable<
RazorSourceDocument
, RazorSyntaxTree> s_importTrees = new();
26
foreach (
var
import in codeDocument.Imports)
68
static bool TryGetCachedImportTree(
RazorSourceDocument
import, RazorParserOptions options, [NotNullWhen(true)] out RazorSyntaxTree? tree)
Language\DefaultRazorTagHelperContextDiscoveryPhase.cs (2)
81
private
RazorSourceDocument
? _source;
90
protected
RazorSourceDocument
Source => _source.AssumeNotNull();
Language\DefaultTagHelperResolutionPhase.ComponentTagHelperResolver.cs (6)
68
RazorSourceDocument
sourceDocument)
76
RazorSourceDocument
sourceDocument)
91
RazorSourceDocument
sourceDocument,
141
RazorSourceDocument
sourceDocument,
190
RazorSourceDocument
sourceDocument)
323
RazorSourceDocument
sourceDocument)
Language\DefaultTagHelperResolutionPhase.cs (10)
71
var
sourceDocument = codeDocument.Source;
96
public readonly
RazorSourceDocument
SourceDocument;
99
public ResolutionContext(
RazorSourceDocument
sourceDocument, DocumentIntermediateNode documentNode)
842
RazorSourceDocument
sourceDocument)
878
RazorSourceDocument
sourceDocument)
917
RazorSourceDocument
sourceDocument)
1218
RazorSourceDocument
sourceDocument,
1265
RazorSourceDocument
sourceDocument)
1307
RazorSourceDocument
sourceDocument);
1315
RazorSourceDocument
sourceDocument);
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (16)
22
RazorSourceDocument
sourceDocument)
30
RazorSourceDocument
sourceDocument)
40
RazorSourceDocument
sourceDocument,
116
RazorSourceDocument
sourceDocument,
206
RazorSourceDocument
sourceDocument)
265
RazorSourceDocument
sourceDocument)
336
RazorSourceDocument
sourceDocument)
450
private static void ConvertValueChildren(IntermediateNode targetNode, HtmlAttributeIntermediateNode htmlAttr, bool isBoundStringProperty,
RazorSourceDocument
sourceDocument)
532
private static void ConvertDynamicNonStringValueChildren(IntermediateNode targetNode, HtmlAttributeIntermediateNode htmlAttr,
RazorSourceDocument
sourceDocument)
559
private static void ConvertMixedLiteralAndExpressionValue(IntermediateNode targetNode, HtmlAttributeIntermediateNode htmlAttr,
RazorSourceDocument
sourceDocument)
718
private static void ConvertPureCSharpExpressionValue(IntermediateNode targetNode, HtmlAttributeIntermediateNode htmlAttr,
RazorSourceDocument
sourceDocument)
1231
RazorSourceDocument
sourceDocument)
1289
RazorSourceDocument
sourceDocument)
1393
RazorSourceDocument
sourceDocument)
1408
RazorSourceDocument
sourceDocument)
1468
RazorSourceDocument
sourceDocument)
Language\Extensions\DefaultMetadataIdentifierFeature.cs (1)
16
public string GetIdentifier(RazorCodeDocument codeDocument,
RazorSourceDocument
sourceDocument)
Language\Extensions\IMetadataIdentifierFeature.cs (4)
9
/// A <see cref="IRazorEngineFeature"/> that can calculate the identifier for a <see cref="
RazorSourceDocument
"/>.
14
/// Gets the identifier for a <see cref="
RazorSourceDocument
"/>.
17
/// <param name="sourceDocument">The <see cref="
RazorSourceDocument
"/>.</param>
19
string GetIdentifier(RazorCodeDocument codeDocument,
RazorSourceDocument
sourceDocument);
Language\Extensions\MetadataAttributePass.cs (1)
126
foreach (
var
import in codeDocument.Imports)
Language\Legacy\ClassifiedSpanVisitor.cs (2)
22
private
RazorSourceDocument
_source = null!;
33
private void Initialize(
RazorSourceDocument
source)
Language\Legacy\ParserContext.cs (2)
16
public
RazorSourceDocument
SourceDocument { get; }
28
public ParserContext(
RazorSourceDocument
source, RazorParserOptions options, CancellationToken cancellationToken = default)
Language\Legacy\RazorParser.cs (1)
24
public virtual RazorSyntaxTree Parse(
RazorSourceDocument
source, CancellationToken cancellationToken = default)
Language\Legacy\SeekableTextReader.cs (1)
23
public SeekableTextReader(
RazorSourceDocument
source) : this(source.Text, source.FilePath)
Language\Legacy\TagHelperBlockRewriter.cs (1)
66
RazorSourceDocument
source)
Language\Legacy\TagHelperParseTreeRewriter.cs (6)
56
RazorSourceDocument
source,
67
private readonly
RazorSourceDocument
_source = source;
698
RazorSourceDocument
source)
716
RazorSourceDocument
source)
729
private static SourceLocation GetStartTagDeclarationErrorStart(MarkupStartTagSyntax tagBlock,
RazorSourceDocument
source)
734
private static SourceLocation GetEndTagDeclarationErrorStart(MarkupEndTagSyntax tagBlock,
RazorSourceDocument
source)
Language\Legacy\TagHelperSpanVisitor.cs (2)
12
private readonly
RazorSourceDocument
_source;
15
private TagHelperSpanVisitor(
RazorSourceDocument
source, ImmutableArray<TagHelperSpanInternal>.Builder spans)
Language\NamespaceComputer.cs (1)
219
private
RazorSourceDocument
? _source;
Language\RazorCodeDocument.cs (7)
17
public
RazorSourceDocument
Source { get; }
18
public ImmutableArray<
RazorSourceDocument
> Imports { get; }
41
RazorSourceDocument
source,
42
ImmutableArray<
RazorSourceDocument
> imports,
73
RazorSourceDocument
source,
79
RazorSourceDocument
source,
80
ImmutableArray<
RazorSourceDocument
> imports,
Language\RazorHtmlWriter.cs (3)
21
private readonly
RazorSourceDocument
_source;
32
private RazorHtmlWriter(
RazorSourceDocument
source, CodeWriter codeWriter)
41
var
source = codeDocument.Source;
Language\RazorProjectEngine.cs (20)
70
RazorSourceDocument
source,
72
ImmutableArray<
RazorSourceDocument
> importSources,
96
RazorSourceDocument
source,
98
ImmutableArray<
RazorSourceDocument
> importSources,
122
RazorSourceDocument
source,
124
ImmutableArray<
RazorSourceDocument
> importSources,
143
RazorSourceDocument
source,
145
ImmutableArray<
RazorSourceDocument
> importSources,
155
RazorSourceDocument
source,
157
ImmutableArray<
RazorSourceDocument
> importSources,
170
var
source = projectItem.GetSource();
178
RazorSourceDocument
source,
180
ImmutableArray<
RazorSourceDocument
> importSources,
199
var
source = projectItem.GetSource();
206
RazorSourceDocument
sourceDocument,
208
ImmutableArray<
RazorSourceDocument
> importSources,
492
private ImmutableArray<
RazorSourceDocument
> GetImportSources(RazorProjectItem projectItem, bool designTime)
507
internal static ImmutableArray<
RazorSourceDocument
> GetImportSourceDocuments(
511
using var imports = new PooledArrayBuilder<
RazorSourceDocument
>(importItems.Count);
520
var
sourceDocument = importItem.GetSource();
Language\RazorProjectEngineExtensions.cs (28)
12
public static RazorCodeDocument CreateCodeDocument(this RazorProjectEngine projectEngine,
RazorSourceDocument
source)
15
public static RazorCodeDocument CreateCodeDocument(this RazorProjectEngine projectEngine,
RazorSourceDocument
source, RazorFileKind fileKind)
20
RazorSourceDocument
source,
21
ImmutableArray<
RazorSourceDocument
> importSources)
26
RazorSourceDocument
source,
28
ImmutableArray<
RazorSourceDocument
> importSources)
33
RazorSourceDocument
source,
39
RazorSourceDocument
source,
46
RazorSourceDocument
source,
47
ImmutableArray<
RazorSourceDocument
> importSources,
53
RazorSourceDocument
source,
55
ImmutableArray<
RazorSourceDocument
> importSources,
61
RazorSourceDocument
source,
63
ImmutableArray<
RazorSourceDocument
> importSources = default,
73
public static RazorCodeDocument CreateDesignTimeCodeDocument(this RazorProjectEngine projectEngine,
RazorSourceDocument
source)
76
public static RazorCodeDocument CreateDesignTimeCodeDocument(this RazorProjectEngine projectEngine,
RazorSourceDocument
source, RazorFileKind fileKind)
81
RazorSourceDocument
source,
82
ImmutableArray<
RazorSourceDocument
> importSources)
87
RazorSourceDocument
source,
89
ImmutableArray<
RazorSourceDocument
> importSources)
94
RazorSourceDocument
source,
100
RazorSourceDocument
source,
107
RazorSourceDocument
source,
108
ImmutableArray<
RazorSourceDocument
> importSources,
114
RazorSourceDocument
source,
116
ImmutableArray<
RazorSourceDocument
> importSources,
122
RazorSourceDocument
source,
124
ImmutableArray<
RazorSourceDocument
> importSources = default,
Language\RazorProjectItem.cs (2)
122
internal virtual
RazorSourceDocument
GetSource()
123
=>
RazorSourceDocument
.ReadFrom(this);
Language\RazorSourceDocument.cs (33)
53
/// Reads the <see cref="
RazorSourceDocument
"/> from the specified <paramref name="stream"/>.
57
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
58
public static
RazorSourceDocument
ReadFrom(Stream stream, string fileName)
71
/// Reads the <see cref="
RazorSourceDocument
"/> from the specified <paramref name="stream"/>.
76
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
77
public static
RazorSourceDocument
ReadFrom(Stream stream, string fileName, Encoding encoding)
95
/// Reads the <see cref="
RazorSourceDocument
"/> from the specified <paramref name="stream"/>.
99
/// <param name="properties">Properties to configure the <see cref="
RazorSourceDocument
"/>.</param>
100
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
101
public static
RazorSourceDocument
ReadFrom(Stream stream, Encoding encoding, RazorSourceDocumentProperties properties)
123
/// Reads the <see cref="
RazorSourceDocument
"/> from the specified <paramref name="projectItem"/>.
126
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
127
public static
RazorSourceDocument
ReadFrom(RazorProjectItem projectItem)
159
/// Creates a <see cref="
RazorSourceDocument
"/> from the specified <paramref name="content"/>.
162
/// <param name="fileName">The file name of the <see cref="
RazorSourceDocument
"/>.</param>
163
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
165
public static
RazorSourceDocument
Create(string content, string fileName)
177
/// Creates a <see cref="
RazorSourceDocument
"/> from the specified <paramref name="content"/>.
180
/// <param name="properties">Properties to configure the <see cref="
RazorSourceDocument
"/>.</param>
181
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
183
public static
RazorSourceDocument
Create(string content, RazorSourceDocumentProperties properties)
199
/// Creates a <see cref="
RazorSourceDocument
"/> from the specified <paramref name="content"/>.
202
/// <param name="fileName">The file name of the <see cref="
RazorSourceDocument
"/>.</param>
204
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
205
public static
RazorSourceDocument
Create(string content, string fileName, Encoding encoding)
223
/// Creates a <see cref="
RazorSourceDocument
"/> from the specified <paramref name="content"/>.
227
/// <param name="properties">Properties to configure the <see cref="
RazorSourceDocument
"/>.</param>
228
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
229
public static
RazorSourceDocument
Create(string content, Encoding encoding, RazorSourceDocumentProperties properties)
251
/// Creates a <see cref="
RazorSourceDocument
"/> from the specified <paramref name="text"/>.
254
/// <param name="properties">Properties to configure the <see cref="
RazorSourceDocument
"/>.</param>
255
/// <returns>The <see cref="
RazorSourceDocument
"/>.</returns>
256
public static
RazorSourceDocument
Create(SourceText text, RazorSourceDocumentProperties properties)
Language\RazorSourceDocumentProperties.cs (1)
7
/// Use to configure optional properties for creating a <see cref="
RazorSourceDocument
"/>.
Language\RazorSyntaxTree.cs (3)
16
public
RazorSourceDocument
Source { get; }
23
RazorSourceDocument
source,
74
RazorSourceDocument
source,
Language\SpanComputer.cs (1)
94
public readonly SourceSpan ToSourceSpan(
RazorSourceDocument
source)
Language\Syntax\SyntaxNodeExtensions.cs (5)
43
public static SourceLocation GetSourceLocation(this SyntaxNodeOrToken nodeOrToken,
RazorSourceDocument
source)
48
public static SourceLocation GetSourceLocation(this SyntaxNode node,
RazorSourceDocument
source)
83
public static SourceLocation GetSourceLocation(this SyntaxToken token,
RazorSourceDocument
source)
118
public static SourceSpan GetSourceSpan(this SyntaxNode node,
RazorSourceDocument
source)
126
public static SourceSpan GetSourceSpan(this SyntaxToken token,
RazorSourceDocument
source)
SourceGenerators\SourceGeneratorProjectItem.cs (3)
15
private readonly
RazorSourceDocument
? _source;
35
_source =
RazorSourceDocument
.Create(text, RazorSourceDocumentProperties.Create(AdditionalText.Path, relativePhysicalPath));
59
internal override
RazorSourceDocument
? GetSource() => _source;
Microsoft.CodeAnalysis.Razor.Workspaces (24)
DocumentMapping\AbstractDocumentMappingService.cs (1)
372
var
sourceDocument = csharpDocument.CodeDocument.Source;
DocumentMapping\RazorEditService_Methods.cs (1)
44
var
source = codeDocument.Source;
Extensions\LspExtensions_SyntaxNode.cs (1)
12
public static LspRange GetRange(this SyntaxNode node,
RazorSourceDocument
source)
Extensions\LspExtensions_SyntaxToken.cs (1)
12
public static LspRange GetRange(this SyntaxToken token,
RazorSourceDocument
source)
Extensions\RazorCodeDocumentExtensions_ClassifiedSpans.cs (2)
52
private
RazorSourceDocument
_source;
61
private void Initialize(
RazorSourceDocument
source)
Extensions\RazorSyntaxNodeExtensions.cs (2)
202
public static LinePositionSpan GetLinePositionSpan(this SyntaxNode node,
RazorSourceDocument
sourceDocument)
435
public static bool TryGetLinePositionSpanWithoutWhitespace(this SyntaxNode node,
RazorSourceDocument
source, out LinePositionSpan linePositionSpan)
Extensions\RazorSyntaxNodeOrTokenExtensions.cs (1)
15
public static LinePositionSpan GetLinePositionSpan(this SyntaxNodeOrToken nodeOrToken,
RazorSourceDocument
source)
Extensions\RazorSyntaxTokenExtensions.cs (1)
57
public static LinePositionSpan GetLinePositionSpan(this SyntaxToken token,
RazorSourceDocument
source)
FoldingRanges\UsingsFoldingRangeProvider.cs (1)
18
var
sourceDocument = codeDocument.Source;
Formatting\Passes\RazorFormattingPass.cs (10)
58
var
source = syntaxTree.Source;
72
private static void TryFormatBlocks(FormattingContext context, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, RazorSyntaxNode node)
82
private static bool TryFormatSectionBlock(FormattingContext context, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, RazorSyntaxNode node)
137
private static bool TryFormatFunctionsBlock(FormattingContext context, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, RazorSyntaxNode node)
178
private static bool TryFormatCSharpExplicitTransition(FormattingContext context, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, RazorSyntaxNode node)
200
private static bool TryFormatComplexCSharpBlock(FormattingContext context, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, RazorSyntaxNode node)
222
private static bool TryFormatHtmlInCSharp(FormattingContext context, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, RazorSyntaxNode node)
240
private static void TryFormatCSharpBlockStructure(FormattingContext context, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, RazorSyntaxNode node)
349
private static void FormatWhitespaceBetweenDirectiveAndBrace(RazorSyntaxNode node, RazorDirectiveSyntax directive, ref PooledArrayBuilder<TextChange> changes,
RazorSourceDocument
source, FormattingContext context, bool forceNewLine)
374
private static bool FormatBlock(FormattingContext context,
RazorSourceDocument
source, RazorSyntaxNode? directiveNode, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode, RazorSyntaxNode closeBraceNode, ref PooledArrayBuilder<TextChange> changes)
SemanticTokens\SemanticTokensVisitor.cs (3)
557
var
source = _razorCodeDocument.Source;
596
var
source = _razorCodeDocument.Source;
633
static int GetLastNonWhitespaceCharacterOffset(
RazorSourceDocument
source, int lineStartAbsoluteIndex, int lineLength)
Microsoft.CodeAnalysis.Razor.Workspaces.UnitTests (16)
Completion\CSharpRazorKeywordCompletionItemProviderTests.cs (3)
112
var
sourceDocument =
RazorSourceDocument
.Create("", RazorSourceDocumentProperties.Default);
124
var
sourceDocument = TestRazorSourceDocument.Create(text.Text);
Completion\DefaultRazorCompletionFactsServiceTest.cs (2)
18
var
sourceDocument =
RazorSourceDocument
.Create("", RazorSourceDocumentProperties.Default);
Completion\DirectiveAttributeTransitionCompletionItemProviderTest.cs (1)
332
var
sourceDocument = TestRazorSourceDocument.Create(text.Text);
Completion\DirectiveCompletionItemProviderTest.cs (3)
426
var
sourceDocument =
RazorSourceDocument
.Create("", RazorSourceDocumentProperties.Default);
467
var
sourceDocument = TestRazorSourceDocument.Create(text.Text);
Completion\MarkupTransitionCompletionItemProviderTest.cs (3)
299
var
sourceDocument =
RazorSourceDocument
.Create("", RazorSourceDocumentProperties.Default);
316
var
sourceDocument = TestRazorSourceDocument.Create(text.Text);
Completion\RazorCompletionListProviderTest.cs (1)
545
var
sourceDocument = TestRazorSourceDocument.Create(text, filePath: documentFilePath);
Extensions\RazorCodeDocumentExtensionsTest.cs (1)
356
var
sourceDocument = TestRazorSourceDocument.Create(code.Text);
FindNodeTests.cs (1)
253
var syntaxTree = RazorSyntaxTree.Parse(
RazorSourceDocument
.Create(input, "test.razor"));
TagHelperFactsServiceTest.cs (1)
244
var
sourceDocument = TestRazorSourceDocument.Create(text);
Microsoft.VisualStudio.LanguageServices.Razor.UnitTests (7)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\AutoInsert\RazorOnAutoInsertProviderTestBase.cs (2)
62
var
sourceDocument =
RazorSourceDocument
.Create(text, RazorSourceDocumentProperties.Create(path, path));
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\CodeActions\Html\HtmlCodeActionProviderTest.cs (1)
136
var
sourceDocument = TestRazorSourceDocument.Create(text, filePath: filePath, relativePath: filePath);
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\FormattingContentValidationPassTest.cs (2)
102
var
sourceDocument =
RazorSourceDocument
.Create(text, RazorSourceDocumentProperties.Create(path, path));
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\RazorDocumentMappingServiceTest.cs (2)
774
var
sourceDocument = TestRazorSourceDocument.Create(razorSource);
811
var
sourceDocument = TestRazorSourceDocument.Create(razorSource);
Microsoft.VisualStudioCode.RazorExtension.UnitTests (7)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\AutoInsert\RazorOnAutoInsertProviderTestBase.cs (2)
62
var
sourceDocument =
RazorSourceDocument
.Create(text, RazorSourceDocumentProperties.Create(path, path));
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\CodeActions\Html\HtmlCodeActionProviderTest.cs (1)
136
var
sourceDocument = TestRazorSourceDocument.Create(text, filePath: filePath, relativePath: filePath);
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\FormattingContentValidationPassTest.cs (2)
102
var
sourceDocument =
RazorSourceDocument
.Create(text, RazorSourceDocumentProperties.Create(path, path));
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\RazorDocumentMappingServiceTest.cs (2)
774
var
sourceDocument = TestRazorSourceDocument.Create(razorSource);
811
var
sourceDocument = TestRazorSourceDocument.Create(razorSource);