Skip to content
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

Follow up items after PR 41363 #41462

Closed
4 of 23 tasks
mavasani opened this issue Feb 6, 2020 · 4 comments
Closed
4 of 23 tasks

Follow up items after PR 41363 #41462

mavasani opened this issue Feb 6, 2020 · 4 comments
Assignees
Labels
Area-IDE Bug Need Design Review The end user experience design needs to be reviewed and approved.
Milestone

Comments

@mavasani
Copy link
Contributor

mavasani commented Feb 6, 2020

During the design meeting discussion on #41363, we decided to go ahead with the current approach in the PR with the following follow-up items:

  • [Implemented with 41687 and 41768] De-dupe analyzers and code fixes in IDE Features layer and Code Style layer inside the diagnostic analyzer and code fix engines. Currently, both the copies execute and we also see duplicate diagnostics being reported.
  • Remove MEF based discovery of language services. Replace it with an explicit mapping from each language service to the type implementing it. We also need to design how external clients, similar to CodeStyle, can be supported, which means we may not be able to explicitly hardcode the assembly/types that implement the language services.
  • Remove duplicated resources from CodeStyle and Workspaces/Features layer with a shared resource file. Need to wait on @tmat's change that simplifies resource generation in Roslyn.sln.
  • Revert changes required to get existing IDE analyzer/fixer tests working in CodeStyle layer once all the tests are switched to Microsoft.CodeAnalysis.Testing:
    • Test framework files linked into CodeStyle.UnitTests projects
    • IVTs added from Roslyn test utilities and Workspaces to CodeStyle.UnitTests projects
    • Project references added to test utilities project
  • Move all our analyzers and fixers to work completely based on AnalyzerConfigOptions instead of OptionSet. This involves adding support for creating and passing a fallback .editorconfig/AnalyzerConfigOptions from Tools Options settings into analysis context.
  • Remove use of GetDocumentOptionSetAsync API in the shared layer, which is currently used to get fallback Workspace options. Likely the work in prior bullet item will automatically take care of this, but adding an explicit cleanup item here so we validate that.
  • Remove the TODOs added for code moved to shared layer which uses very recently added compiler APIs, which are not yet available in CodeStyle layer. For example, see this comment.
  • [Implemented with 42323] Remove all the #if CODE_STYLE from the shared projects. All of them should be possible to remove trivially, except the ones related to public Options related types (OptionSet, IOption, CodeStyleOption, CodeStyleOptions, NotificationOptions, etc.), which are public APIs in Workspaces layer but also need by the CodeStyle analyzers which do not have access to Workspaces.
  • We have lot more scope of refactoring the existing extension methods and utilities in Workspaces layer and move them down into the shared layers. There is scope even to move lot of code in WorkspaceExtensions layer that is currently used by code fixes, but not specific to Workspaces itself, to be moved down to CompilerExtensions layer. This will likely be a continuous refactoring work item.
  • CodeAction.DocumentChangeAction is used in IDE code fixes, and was replaced with a new type CustomCodeActions in shared layer. Do we want to get rid of the CustomCodeActions types completely? Do we want to avoid them just in CodeStyle layer but still use them for analyzers linked into Features? Latter will introduce #if CODE_STYLE clutter in each code fix file, which seems undesirable.
  • Cleanup the API signature for SytnaxEditorBasedCodeFixProvider.IncludeDiagnosticDuringFixAll as per Refactor extensions and utilities in Workspaces layer into shared pro… #41510 (comment)
  • Remove AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.IsRegularCommentOrDocComment and directly call into syntax facts service once it is available in shared analyzer layer.
  • Consider deleting IGeneratedCodeRecognitionService.IsGeneratedCode and moving all existing callers to IGeneratedCodeRecognitionService.IsGeneratedCodeAsync
  • Rationalize use of SyntaxGenerator.GetGenerator(document) versus document.GetRequiredLanguageService<SyntaxGenerator>() in our code base.
  • [Addressed with 43367] Revert #if CODE_STYLE directives added to product source and tests due for the scenario where certain new Nullability APIs are not yet available in CodeStyle layer. This might mean either moving the CodeStyle layer to new Microsoft.CodeAnalysis API OR adding reflection based lightup support in CodeStyle layer.
  • Revert #if CODE_STYLE directives related to ITypeSymbol.IsNativeIntegerType (not yet available in CodeStyle layer). See PR Follow up items after PR 41363 #41462
  • Consider porting ISemanticFactsService to shared CompilerExtensions project so they can be used in our analyzers in the shared layer. See Port UseThrowExpression analyzer/fixer to shared layer #42264 (comment)
  • Nullability related changes mentioned in Move Options and CodeStyle APIs to shared layer #42323 (comment) and Move Options and CodeStyle APIs to shared layer #42323 (comment)
  • Update nullability of OptionSet in EditorConfigStorageLocation2 to allow null values. See Move Options and CodeStyle APIs to shared layer #42323 (comment)
  • Move all the IDE tests that use options to pass in IOptionsCollection instead of IDictionary<OptionKey, object. See Move Options and CodeStyle APIs to shared layer #42323 (comment)
@mavasani
Copy link
Contributor Author

mavasani commented Feb 7, 2020

Tag @tmat @sharwell @jasonmalinowski - let me know if I forgot any other follow-up cleanup items that we came up with in the meeting.

mavasani added a commit to mavasani/roslyn that referenced this issue Feb 19, 2020
Extracted from dotnet#41363
Third follow-up item from dotnet#41462

Apart from adding resx files, changes also include:
1. Moving resource strings duplicated across Workspaces and CodeStyle layer into the shared resx files
2. Source file changes to use the resource strings from the shared resx.

We should no longer require use of `#if CODE_STYLE` in the shared layer for the purpose of resource strings.
mavasani added a commit to mavasani/roslyn that referenced this issue Feb 20, 2020
Extracted out of dotnet#41363 so it only contains the following changes:

1. Port analyzer/fixer/test files for ConvertSwitchStatementToExpression to shared layer
2. Options related namespace changes (see comment dotnet#41363 (comment) for details)
3. MEF based language service discovery in CodeStyle layer. dotnet#41462 tracks replacing this with a non-MEF based approach.
4. Minimal resx/xlf file changes - few were needed as the resources used by analyzer/fixer were moved to shared resx file.
5. Enable .editorconfig based unit test support for CodeStyle layer. NOTE: First commit dotnet@b006324 just ports changes from dotnet#40513 which are required to enable this support. This commit should become redundant once that PR is merged in.
mavasani added a commit to mavasani/roslyn that referenced this issue Feb 27, 2020
This unblocks porting analyzers to CodeStyle layer. dotnet#41462 tracks replacing this with a non-MEF based approach.
mavasani added a commit to mavasani/roslyn that referenced this issue Mar 4, 2020
This unblocks porting analyzers to CodeStyle layer. dotnet#41462 tracks replacing this with a non-MEF based approach.
@mavasani mavasani added the Need Design Review The end user experience design needs to be reviewed and approved. label Mar 6, 2020
@mavasani
Copy link
Contributor Author

mavasani commented Mar 6, 2020

@sharwell @CyrusNajmabadi can we bring this to Monday's design meeting to review specifically the last item?

Revert #if CODE_STYLE directives added to product source and tests due for the scenario where certain new Nullability APIs are not yet available in CodeStyle layer. This might mean either moving the CodeStyle layer to new Microsoft.CodeAnalysis API OR adding reflection based lightup support in CodeStyle layer.

It should hopefully be a quick discussion and would bring back bunch of missing functionality in CodeStyle layer.

@mavasani
Copy link
Contributor Author

Marking for next meeting - we need to really decide if we are going to use lightup/reflection in CodeStyle layer or become lenient in moving CodeStyle layer to newer Microsoft.CodeAnalysis to be able to access newly added APIs.

@CyrusNajmabadi
Copy link
Member

Closing out as we haven't done anything with this in 4 years.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Need Design Review The end user experience design needs to be reviewed and approved.
Projects
Status: Complete
Development

No branches or pull requests

3 participants