Elm Debugger limits the length of the text it displays. This is especially annoying when I want to examine the entire message that I’ve received.
I’ve overwritten some code in Debugger to make it display full texts instead of eillipses.
It’s not the most legible text, but it has all information in there. I did it by replacing the messageToString
function in elm-stuff/packages/elm-lang/virtual-dom/2.0.4/src/Native/Debugger.js
with the following code:
function messageToString(value) {
var result = '';
for (var key in value)
{
result = result + ' ' + messageToStringHelper(value[key]);
}
return result;
}
function toFlatArray(value, result)
{
if (value['ctor'] === '[]')
{
return result;
}
else
{
var new_result = [...result, value['_0']];
return toFlatArray(value['_1'], new_result);
}
}
function messageToStringHelper(value)
{
switch (typeof value)
{
case 'boolean':
return value ? 'True' : 'False';
case 'number':
return value + '';
case 'string':
return addSlashes(value, false);
}
if (value instanceof String)
{
return '\'' + addSlashes(value, true) + '\'';
}
if (typeof value !== 'object' || value === null)
{
return '…';
}
if (typeof value === 'object' && !('ctor' in value))
{
var result = [];
for (var key in value)
{
result.push(key + ': ' + messageToStringHelper(value[key]));
}
return '{' + result.join(', ') + '}';
}
if (value.ctor.match(/^\_Task/))
{
return '…';
}
if (value.ctor.match(/^\_Tuple/))
{
var tupleResult = [];
for (var key in value)
{
if (key !== 'ctor')
{
tupleResult.push(value[key]);
}
}
return '(' + tupleResult.map(messageToStringHelper).join(', ') + ')';
}
if (['<decoder>', '_Process', 'Set_elm_builtin', 'RBNode_elm_builtin', 'RBEmpty_elm_builtin'].indexOf(value.ctor) >= 0)
{
return '…';
}
if (value.ctor === '::')
{
var arrayResult = toFlatArray(value, []).map(messageToStringHelper);
return '[' + arrayResult.join(', ') + ']';
}
if (typeof value === 'object')
{
var result = '';
for (var key in value)
{
result = result + ' ' + messageToStringHelper(value[key]);
}
return result;
}
}
It definitely has a lot of room for improvement, so feel free to modify it! I hope it helps your development process.