Open FMorschel opened 2 months ago
I suppose this would be a job for the formatter? JS example
Select foo.charAt(0)
, "Add to Watch", it's displayed poorly
Could at least just .trim()
it and escape \n
for display.
I suppose this would be a job for the formatter?
Do you mean send a formatRange request and apply it only to the expression being added to the watch? Would it get messed up if the formatter returned an edit that is slightly larger than the expression?
I wonder if it'd be better to have some specific API for simplifying the expression given a range. For example, you might also want to remove comments inside the expression for watch/evaluation:
myList
// Filter by foo because reasons...
.where((i) => i.foo);
Watch expressions should allow LSP or debugger to remove inner whitespace.
In languages like Dart, most of the time (and even more so in the future with the new tall formatter) you can select multiple lines that represent a single expression and add them to the watch list.
Currently, we end up with lots of whitespaces between every line because of indentation and such. There could be an option for the LSP or debugger to remove inner spaces when that will not interfere with the expression (like spaces inside strings and such should not be removed).
Edit
This could be expanded to remove trailing
;
and similar as well.