templating icon indicating copy to clipboard operation
templating copied to clipboard

macros 2.0

Open vlada-shubina opened this issue 3 years ago • 1 comments
trafficstars

Problem

Macros are pain point for a while when it comes to refactoring and code understanding. I struggled a lot to write documentation for them as interfaces were very vague.

Docs effort: fixes https://github.com/dotnet/templating/issues/5028 fixes https://github.com/dotnet/templating/issues/4616

Solution

This is 7.0.2xx(?)/8.0.1xx effort.

  • created better interfaces for macro component based on generics
  • created base types for macro and macro config implementation that do common actions
  • cleaned up the logic of macro processing
    • if macro relies on other variable, and this variable doesn't exist - the processing stops
    • changed logic in GeneratePort macro - previously macro was not releasing socket until the macro is run. Now tracking the list of assigned ports instead.
  • added logging
  • fixed https://github.com/dotnet/templating/issues/5028

TODO:

  • [x] add doc on how to add a new macro
  • [x] localization
  • [x] better unit tests

Checks:

  • [x] Added unit tests
  • [x] Added #nullable enable to all the modified files ?

vlada-shubina avatar Sep 07 '22 16:09 vlada-shubina

@JanKrivanek I would like to kick of the review of this PR, though I'm still working on improving the test coverage.

The areas of review:

  • new macro component interfaces - it would be good to have it pre-ready in case we start to support custom components.
  • updated macro logic and improved parsing of the configuration with error handling.
  • documentation

vlada-shubina avatar Sep 23 '22 09:09 vlada-shubina

Open tasks:

  • agree on coalesce behavior
  • investigate bug when TemplateCreator can return null
  • investigate how often float and hex types are used

vlada-shubina avatar Oct 19 '22 12:10 vlada-shubina