Coder Social home page Coder Social logo

Comments (11)

DoctorKrolic avatar DoctorKrolic commented on May 23, 2024 8

I am happy to announce that the underlying issue with NormalizeWhitespace API has been resolved. The fix will be available in the next version of roslyn SDK. If you find any broken cases or other bugs in this area, feel free to open new issues at dotnet/roslyn

from mapperly.

latonz avatar latonz commented on May 23, 2024 1

I recognize the issue, but will probably wait until something better is available from Microsoft. Implementing something custom to fix this issue is not in scope for Mapperly.

from mapperly.

DoctorKrolic avatar DoctorKrolic commented on May 23, 2024 1

As far as I know, MS.CA.* packages are bound to Visual Studio releases. So 4.5 version should become available as soon as VS 17.5 releases. But I am not completely sure about that

from mapperly.

latonz avatar latonz commented on May 23, 2024

Mapperly uses NormalizeWhitespace of roslyn which produces this formatting. Either an issue needs to be opened in the roslyn repo or Mapperly would need to implement a formatter which is applied after NormalizeWhitespace is called 🤔

from mapperly.

sid-6581 avatar sid-6581 commented on May 23, 2024

NormalizeWhitespace has several issues, like this one, and the fact that it's very slow, so it's not ideal for use in source generators the way things currently are. Inserting trivia manually and not using NormalizeWhitespace is another option. If using NormalizeWhitespace you either have to insert trivia manually after anyway, or use the formatting stuff. I think that needs a workspace, though, and that sounds even slower which isn't great for a source generator.

from mapperly.

sid-6581 avatar sid-6581 commented on May 23, 2024

That's totally fair. Unfortunately it's not an issue for Microsoft either, so I wouldn't expect anything from them. There's a PR for a slight performance improvement in NormalizeWhitespace, but that's the only thing I'm aware of. Now that source generators are becoming so popular I would expect the community to come up with something before MS does.

from mapperly.

latonz avatar latonz commented on May 23, 2024

Good point. We will certainly use solutions provided by the community, not only from Microsoft themselves.

from mapperly.

CommonGuy avatar CommonGuy commented on May 23, 2024

This is being tracked in dotnet/roslyn#61204. There are also some open issues about the poor performance of NormalizeWhitespace, as it is being used more often in source generators for a lack of a better alternative.

from mapperly.

MisinformedDNA avatar MisinformedDNA commented on May 23, 2024

This project uses Roslyn APIs which you would think would make perfect sense. But if you look at MS's generators, they don't even use them, they just write strings out directly. I guess they already knew their code generation API was crappy.

from mapperly.

latonz avatar latonz commented on May 23, 2024

@DoctorKrolic do you know when Microsoft.CodeAnalysis.CSharp 4.5 is released? I couldn't find any information on the release schedule of the roslyn sdk. Is it going to be released with dotnet 7.0.3? or not until 7.1 / 8.0?

from mapperly.

github-actions avatar github-actions commented on May 23, 2024

🎉 This issue has been resolved in version 2.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from mapperly.

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.