added automatic wrapping of command results and removed the manual wrappers from the demo code#514
added automatic wrapping of command results and removed the manual wrappers from the demo code#514jurgenvinju wants to merge 3 commits intomainfrom
Conversation
…appers from the demo code
|
I do not feel comfortable with this PR in the current state, since people have used these actions to transfer large rascal values to typescript. Both maps and ADTs will generate a proper json object, and are being used to transfer in a way that the json object maps into a class in typescript. Maybe we should change the heuristics such that if the value cannot be translated to a proper json root value (aka not a boolean, list or map) than we wrap it with an result map? Also, this close to a release I propose we'll not be merging this untill after the release, so we get time to test this at the different places we know it's used, or contact our users. |
|
I agree with @DavyLandman to not make this breaking change to the command response. The description mentions
Let's extend that, like Davy said - if the value is already supported, continue returning it as-is. If the value would have silently failed before, then wrap it in the new structure. |
|
|
This PR was intended to be backward compatible. I'll write some tests to that end so we can see where this fails to be the case. In my mind it was 🙈 |



This makes the Rascal LSP and the Parametric LSP wrap the values
vthat come out of the Rascal-based command executors in a("result" : b)map.{'result' : mapped(b)}object.trueor1or"groetjes", without the JSON-RPC bridge silently failingvalue (Command _)as the type signature of all command evaluator functions, Rascal's type system could not check that the return type was not a primitive. Now it does not need to do that anymore.return ("result" : xxx)manually. So all places where that happens we could writereturn xxxinstead.("result":xxx)and then we don't wrap again for backward compatibility.