-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FUSE] Fix C# completion in empty explicit expression blocks #11282
Merged
davidwengier
merged 5 commits into
dotnet:main
from
davidwengier:ExplicitStatementCompletionFUSE
Dec 9, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d5871f7
Create a failing test
davidwengier daa7023
Emit source mappings for blank C# code blocks
davidwengier 83b8f91
Add new tests and baselines for the new tests
davidwengier bd51cf3
Don't validate line pragmas for whitespace in design time
davidwengier 7715748
Re-generate baselines
davidwengier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...omponentDesignTimeCodeGenerationTest/ExplicitExpression_HtmlOnly/TestComponent.codegen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// <auto-generated/> | ||
#pragma warning disable 1591 | ||
namespace Test | ||
{ | ||
#line default | ||
using global::System; | ||
using global::System.Collections.Generic; | ||
using global::System.Linq; | ||
using global::System.Threading.Tasks; | ||
using global::Microsoft.AspNetCore.Components; | ||
#line default | ||
#line hidden | ||
#nullable restore | ||
public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase | ||
#nullable disable | ||
{ | ||
#pragma warning disable 219 | ||
private void __RazorDirectiveTokenHelpers__() { | ||
} | ||
#pragma warning restore 219 | ||
#pragma warning disable 0414 | ||
private static object __o = null; | ||
#pragma warning restore 0414 | ||
#pragma warning disable 1998 | ||
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) | ||
{ | ||
|
||
|
||
|
||
|
||
} | ||
#pragma warning restore 1998 | ||
} | ||
} | ||
#pragma warning restore 1591 |
21 changes: 21 additions & 0 deletions
21
...ts/ComponentDesignTimeCodeGenerationTest/ExplicitExpression_HtmlOnly/TestComponent.ir.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Document - | ||
NamespaceDeclaration - - Test | ||
UsingDirective - (3:1,1 [20] ) - global::System | ||
UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic | ||
UsingDirective - (69:3,1 [25] ) - global::System.Linq | ||
UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks | ||
UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components | ||
ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - | ||
DesignTimeDirective - | ||
CSharpCode - | ||
IntermediateToken - - CSharp - #pragma warning disable 0414 | ||
CSharpCode - | ||
IntermediateToken - - CSharp - private static object __o = null; | ||
CSharpCode - | ||
IntermediateToken - - CSharp - #pragma warning restore 0414 | ||
MethodDeclaration - - protected override - void - BuildRenderTree | ||
CSharpCode - (2:0,2 [6] x:\dir\subdir\Test\TestComponent.cshtml) | ||
LazyIntermediateToken - (2:0,2 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n | ||
MarkupElement - (8:1,4 [7] x:\dir\subdir\Test\TestComponent.cshtml) - p | ||
CSharpCode - (15:1,11 [2] x:\dir\subdir\Test\TestComponent.cshtml) | ||
LazyIntermediateToken - (15:1,11 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n |
14 changes: 14 additions & 0 deletions
14
...ponentDesignTimeCodeGenerationTest/ExplicitExpression_HtmlOnly/TestComponent.mappings.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Source Location: (2:0,2 [6] x:\dir\subdir\Test\TestComponent.cshtml) | ||
| | ||
| | ||
Generated Location: (917:26,2 [6] ) | ||
| | ||
| | ||
|
||
Source Location: (15:1,11 [2] x:\dir\subdir\Test\TestComponent.cshtml) | ||
| | ||
| | ||
Generated Location: (936:28,11 [2] ) | ||
| | ||
| | ||
|
33 changes: 33 additions & 0 deletions
33
...ponentDesignTimeCodeGenerationTest/ExplicitExpression_Whitespace/TestComponent.codegen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// <auto-generated/> | ||
#pragma warning disable 1591 | ||
namespace Test | ||
{ | ||
#line default | ||
using global::System; | ||
using global::System.Collections.Generic; | ||
using global::System.Linq; | ||
using global::System.Threading.Tasks; | ||
using global::Microsoft.AspNetCore.Components; | ||
#line default | ||
#line hidden | ||
#nullable restore | ||
public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase | ||
#nullable disable | ||
{ | ||
#pragma warning disable 219 | ||
private void __RazorDirectiveTokenHelpers__() { | ||
} | ||
#pragma warning restore 219 | ||
#pragma warning disable 0414 | ||
private static object __o = null; | ||
#pragma warning restore 0414 | ||
#pragma warning disable 1998 | ||
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) | ||
{ | ||
|
||
|
||
} | ||
#pragma warning restore 1998 | ||
} | ||
} | ||
#pragma warning restore 1591 |
18 changes: 18 additions & 0 deletions
18
.../ComponentDesignTimeCodeGenerationTest/ExplicitExpression_Whitespace/TestComponent.ir.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Document - | ||
NamespaceDeclaration - - Test | ||
UsingDirective - (3:1,1 [20] ) - global::System | ||
UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic | ||
UsingDirective - (69:3,1 [25] ) - global::System.Linq | ||
UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks | ||
UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components | ||
ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - | ||
DesignTimeDirective - | ||
CSharpCode - | ||
IntermediateToken - - CSharp - #pragma warning disable 0414 | ||
CSharpCode - | ||
IntermediateToken - - CSharp - private static object __o = null; | ||
CSharpCode - | ||
IntermediateToken - - CSharp - #pragma warning restore 0414 | ||
MethodDeclaration - - protected override - void - BuildRenderTree | ||
CSharpCode - (2:0,2 [2] x:\dir\subdir\Test\TestComponent.cshtml) | ||
LazyIntermediateToken - (2:0,2 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n |
7 changes: 7 additions & 0 deletions
7
...nentDesignTimeCodeGenerationTest/ExplicitExpression_Whitespace/TestComponent.mappings.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Source Location: (2:0,2 [2] x:\dir\subdir\Test\TestComponent.cshtml) | ||
| | ||
| | ||
Generated Location: (917:26,2 [2] ) | ||
| | ||
| | ||
|
20 changes: 10 additions & 10 deletions
20
...ts/ComponentDesignTimePreprocessorDirectiveTest/StartOfLine_08/TestComponent.mappings.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
Source Location: (2:0,2 [13] x:\dir\subdir\Test\TestComponent.razor) | ||
Source Location: (2:0,2 [13] x:\dir\subdir\Test\TestComponent.razor) | ||
| | ||
#if true | ||
| | ||
Generated Location: (986:28,2 [13] ) | ||
| | ||
Generated Location: (986:28,2 [13] ) | ||
| | ||
#if true | ||
| | ||
|
||
Source Location: (20:3,2 [11] x:\dir\subdir\Test\TestComponent.razor) | ||
| | ||
Source Location: (20:3,2 [11] x:\dir\subdir\Test\TestComponent.razor) | ||
| | ||
#endif | ||
| | ||
Generated Location: (1120:36,2 [11] ) | ||
| | ||
Generated Location: (1120:36,2 [11] ) | ||
| | ||
#endif | ||
| | ||
|
||
| | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we avoid emitting
#line
pragmas for whitespace nodes? (We only need source mappings right?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let @chsienki comment on this, because he recently made it so that line pragmas and source mappings were 1:1 in runtime. Obviously at that point whitespace wouldn't have been part of it, but I'm not sure which priority wins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My original assumption here was that at some point in the future, we may not have any source mappings: if we're getting the docs from the generator, we might not have the back channel for the mappings.
I think with the current architecture that's actually not going to be true, but I do think its a good idea to maintain a 1-1 mapping, so the source doc contains all the information (especially for some of our strategic partners who are using the line pragmas only)