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

Any reason for the 2000 character limit? #81

Open
MichaelHochriegl opened this issue Jul 10, 2023 · 6 comments
Open

Any reason for the 2000 character limit? #81

MichaelHochriegl opened this issue Jul 10, 2023 · 6 comments

Comments

@MichaelHochriegl
Copy link

I really love that you published RoslynQuoter on the web for easy access. What I often stumble over is the fact that "only" 2000 chars are supported.

Is there a reason to not allow larger texts?

@KirillOsenkov
Copy link
Owner

it’s more or less arbitrary, the limit is needed because the resulting program becomes too large and generating and validating it takes too long

@KirillOsenkov
Copy link
Owner

You could also build locally and use as a console app without the limit.

Normally I thought quoter is most useful to show small samples of how to deal with a particular language construct.

If you have a larger program, perhaps think of another way to simplify it or generalize somehow?

@MichaelHochriegl
Copy link
Author

Thanks for the quick reply. I mostly run into the limit when I want to get the roslyn code for my source gens and I have comments in my sample class.

To work around the limit I currently pulled the repo and upped the limit in the QuoterController to 5k. Seems to work fine for now.

@dodexahedron
Copy link

Normally I thought quoter is most useful to show small samples of how to deal with a particular language construct.

This, for sure. Once that seemingly obvious point hit me, I face-palmed and then started using it exactly like that, because it usually is just one little snippet I need to figure out (since intellisense is essentially useless for those libraries - WTF is Green?).

@KirillOsenkov
Copy link
Owner

You can read about red and green trees here:
https://ericlippert.com/2012/06/08/red-green-trees/

and here for deeper technical info:
https://github.com/KirillOsenkov/Bliki/wiki/Roslyn-Immutable-Trees

@dodexahedron
Copy link

dodexahedron commented Dec 13, 2023

Thanks for that!

I hadn't bothered to dive into that, yet, once I realized "the way" it's done, using all the SyntaxFactory and all the appropriate WithX methods and whatnot, but still had that idle curiosity in the back of my mind. I'll have to check those out some time. Anything from Eric is usually a good read.

I just wish that things in that API were mutable, because I tend to end up writing my own extension methods to allow a more fluent and much more concise use of it for the most common cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants