Open phrohdoh opened 4 years ago
It looks like it tries to parse it as string ("{"
) and then encounters the k
.
What is the difference to https://github.com/hediet/vscode-debug-visualizer/pull/75?
My guess is that lldb shortens long strings. The debug visualizer extension is trying out various ways how to parse the string (it tries to remove any surrounding quotation mark), but only reports the last one. So there might be a different json parse error. Can to copy the entire text of the error message and paste it here?
Yeah, it looks like lldb truncates 🤦.
Could not parse evaluation result as JSON:
Unexpected token k in JSON at position 3
Evaluation result was:
"{"kind":{"ast":true,"tree":true,"text":true},"root":{"items":[{"text":"exploding-barrel:"}],"children":[{"items":[{"text":"Tooltip:"}],"children":[],"span":{"start":18,"length":13},"segment":"todo"},{"items":[{"text":"Name: barrels"}],"children":[],"span":{"start":31,"length":22},"segment":"todo"},{"items":[{"text":"Health:"}],"children":[],"span":{"start":53,"length":12},"segment":"todo"},{"items":[{"text":"HP: 5"}],"children":[],"span":{"start":65,"length":14},"segment":"todo"},{"items":[{"text":"Explodes:"}],"children":[],"span":{"start":79,"length":14},"segment":"todo"},{"items":[{"text":"Weapon: large-barrel-explode"}],"children":[],"span":{"start":93,"length":37},"segment":"todo"},{"items":[{"text":"MapEditorData:"}],"children":[],"span":{"start":130,"length":19},"segment":"todo"},{"items":[{"text":"Categories: props, dangerous-props"}],"children":[],"span":{"start":149,"length":43},"segment":"todo"}],"span":{"start":0,"length":193},"segment":"doc-root"},"text":"exploding-barrel:..."
Used debug adapter: lldb
https://stackoverflow.com/a/41600000 may be what we want in this case.
https://github.com/vadimcn/vscode-lldb/blob/master/MANUAL.md#launching-a-new-process
I think initCommands
can be used to configure these things.
Setting target.max-string-summary-length
to 10000
(via initCommands
) seems to make no difference, the string is still truncated (with ...
appended) at the exact same position.
edit: confirmed that max-string-summary-length
is indeed being set to 10000
(via initCommands
) by executing settings show target.max-string-summary-length
in VSCode's debug console, which prints target.max-string-summary-length (int) = 10000
.
Your string is truncated after exactly 1000 chars. Maybe you can reverse search a setting that has that value.
This article also uses target.max-string-summary-length
.
Is the watch windows also truncating the string? What about the debug console?
AFAIK the watch viewlet and debug console are driven by the debug adapter. Yes, both of them display the truncated value.
I do not have any lldb settings with the value 1000
(confirmed by running settings show
and searching over the result).
AFAIK the watch viewlet and debug console are driven by the debug adapter.
Yes, this extension is driven too by the debug adapter. However, the watch viewlet uses the watch
context, the debug console the repl
context, and this extension by default also the repl
context (that you overwrote with watch
).
I do not have any lldb settings with the value 1000 (confirmed by running settings show and searching over the result).
This is unfortunate. If you make it work in the repl context with long strings (maybe there is some special formatting argument), I could extend the json parsing logic to deal with lldb outputs.
If lldb has no way to output long strings, this extension cannot do much.
This is indeed unfortunate. Thank you for your help and time!
I think your main point is still valid. The error reporting is still not good.
With this (completely valid and schema-compliant (
AstTreeVisualizationData
), AFAICT) JSONI am getting the following parse error:
Given my JSON is valid, I'm just stuck. I don't know what to change (and why) to give the visualizer what it wants.
Any insight and ideas on improving this greatly appreciated!