void ToStringAndCompressVariable(IScriptType variable, string s, int maxChars, out string text, out Color color) { switch (variable) { case IScriptBoolean _: color = boolText; text = CompressString(s, maxChars); break; case IScriptInteger _: case IScriptDouble _: color = numberText; text = CompressString(s, maxChars, isNumberValue: true); break; case IScriptString _: color = stringText; text = CompressString(s, maxChars, isStringValue: true); break; case ScriptNull _: color = nullText; text = variable.ToString(); break; default: color = nullText; text = IDEColorCoding.RunColorCode(CompressString(s, maxChars)); break; } }