File types IDE changes#62215
Conversation
|
Just realized this won't pass CI until #61646 is merged 😅. Should still be reviewable though. |
...kspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.NamedTypeSymbolKey.cs
Outdated
Show resolved
Hide resolved
...kspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.NamedTypeSymbolKey.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/KeywordCompletionProviderTests.cs
Show resolved
Hide resolved
| Volatile = 1 << 14, | ||
| Extern = 1 << 15, | ||
| Required = 1 << 16, | ||
| File = 1 << 17, |
There was a problem hiding this comment.
Since you added this API, consider fixing up:
Consider also updating
roslyn/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
Lines 1491 to 1492 in 5510ef9
roslyn/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
Lines 1444 to 1466 in 5510ef9
There was a problem hiding this comment.
It actually wasn't clear to me whether 'file' should be added to this. I assume if the IDE has need to generate syntax for a file type, it would use this. But I don't know if the use case exists. It would be helpful to know whether I should delete and just stub out a bool IsFIle => false; implementation.
There was a problem hiding this comment.
@RikkiGibson This is a public API. So it's very necessary that 'file' is added here (not necessarily in this PR)
A common SyntaxGenerator usage pattern is generator.WithModifiers(node, generator.GetModifiers(node).WithIsX(true))
If the node with a class declaration for file class C { }, and we called WithIsSealed(true) (for example), I expect the resulting node will drop file if the change is not made.
| /// <summary> | ||
| /// Indicates the type is declared in source and is only visible in the file it is declared in. | ||
| /// </summary> | ||
| bool IsFile { get; } |
There was a problem hiding this comment.
📝 For the record, the API review for this is tracked by #62254
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass, compiler changes only (iteration 14)
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
lgtm with the changes suggested by @Youssef1313 . thanks!
| [InlineData("struct", TypeKind.Struct)] | ||
| [InlineData("interface", TypeKind.Interface)] | ||
| [InlineData("enum", TypeKind.Enum)] | ||
| public async Task AddFileType(string kindString, TypeKind typeKind) |
There was a problem hiding this comment.
I wasn't able to figure out how to properly test 'delegate', 'record', or 'record struct' here.
- 'delegate' got me a test crash with a stacktrace consisting only of async thunks..
- I didn't see how to specify 'record' and 'record struct' in here.
|
Are you able to identify a specific editor feature/scenario which will behave incorrectly? I may prefer to file an issue |
I'll take a look |
jcouv
left a comment
There was a problem hiding this comment.
Compiler-side LGTM Thanks (iteration 20)
Related to #60819
@dibarbet for review. This gets us to the min-bar for IDE support.
The SymbolKey changes are important here. Without them EnC will not work at all with the feature. With them we can do some simple EnC without crashing in the IDE. It will still fail when files are added or removed during an EnC session but we anticipate solving that after merging the feature to main, before RTM. #61999