Code Monkey home page Code Monkey logo

Comments (3)

NeVeSpl avatar NeVeSpl commented on June 25, 2024 1

That behaviour was introduced here #75.

In general, it is a good idea to split Save into two functions: Save and AddSource, but as you already noticed #106 adding *.cs files as a source has some problems right now.

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on June 25, 2024

I have created a fork in hope to get the requires changes done. But it seems a split is only possible with heavy refactoring or introducing new APIs / deprecating old ones.

My approach would be to deprecate certain APIs and introduce more flexible ones. I think the steps would be

  • Define NTypewriter.Runtime.IGeneratedFile with properties Path and Content
  • Make IGeneratedFileReaderWriter.Write(string, string) obsolete
  • Add IGeneratedFileReaderWriter.Write(IGeneratedFile)
    • Allows GeneratedFileReaderWriter to cast for certain types implementing IGeneratedFile mentioned blow
  • Add AddSourceFunction based on SaveFunction
    • Pass NTypewriter.SourceGenerator.GeneratedCSharpFile implementing IGeneratedFile to AddRenderedItem
  • Implement IGeneratedFile in RenderedItem
  • Add some logic in ``GeneratedFileReaderWriterfor handlingRenderedItem` and `GeneratedCSharpFile` differently

What do you think?

from ntypewriter.

NeVeSpl avatar NeVeSpl commented on June 25, 2024

I would prefer to add a flag AddToCompilation on NTypewriter.RenderedItem instead of using IGeneratedFile as a marking interface, anyway NTypewriter does not have a reference on NTypewriter.Runtime, so using interface there defined is not an option. Passing that flag through the whole execution path should be enough without introducing any new types.

from ntypewriter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.