Open gregveres opened 8 years ago
No rush on answering. I would like to know how to best debug .tst files. But for this issue, I have realized how I can get away from a 2 dimensional array. I think moving away from the 2-D array makes it easier to work with the classes anyway.
Thanks Greg
There may be a better solution but in terms of general debugging with Typewritter I usually append information to a string then output this within a comment in my template. Something like:
${
static string debugInfo = "";
string PrintDebugInfo(File f){
return debugInfo;
}
string KnockoutType(Property p) {
if (p.Type.IsEnumerable) {
debugInfo = p.Type.ToString();
return p.Type.Name.TrimEnd('[',']');
}
return p.Type;
}
}
/*
Debug Info:
$PrintDebugInfo
/*
ah that's a good idea. I will keep that in mind the next time I need to debug. Thanks.
Nice one @banyard!
It reminded me of days when we used to write printf
statement in C code to debug it
@sonuautade Yeah, but it is better than nothing.
@frhagn Would it be possible to have a way to print message via System.Diagonistics.Debug.WriteLine
or, better yet, to have a flexible logging mechanism such as
${
using Typewriter.Extensions.Types;
using static System.Diagonistics.Debug;
Template(Settings settings)
{
settings.UseLog(WriteLine);
}
}
I'd be happy to create a PR for that if it sounds reasonable/feasible
@aluanhaddad Any progress on that PR?
Or anyone.
I have successfully migrated to NTypewriter. I am still using Typewriter for and old part of my code base that is being migrated to a new UI framework and as I migrate the code base, I migrate from Typewriter to NTypewriter.
In my opinion, the only thing issing from NTypewriter is the automatic running of the template renderer when a file gets saved. But it can definitely handle everything else that I got from Typewriter.
HI @frhagn
I have the following in .tst file and I would like to be able to console.log stuff so I can see what I am working with. Is that possible?
thanks.
I am trying to use a 2 dimensional array in C# and converting that to a knockout observable array, but what appears to be happening is that Property.Type only has a single [] but $Type within a property section seems to have the proper [][]. So I would like to dump out these values to see what I am working with.
Thanks Greg