Open capaj opened 5 years ago
Hmmm. interesting. Should be an easy fix. Care for a PR? I can point you in the right direction :)
for the JSON fix shoud be easy, but currently it suggests these two actions everywhere. Ideally it would only suggested them if a JSX code block is selected.
@capaj As far as i can remember, it relies on babel to check if its a JSX string. This is the place to start investigating: https://github.com/wix/vscode-glean/blob/master/src/extension.ts#L18
I think this will always succeed: https://github.com/wix/vscode-glean/blob/da530190356a755d3703c80f96f7ab8509fb7e7b/src/modules/jsx.ts#L16
JSX doesn't really impose any restrictions as to what can be inserted inside {}
. Any JS expression is valid so I think this would be better refactored into just checking if there is a JSX node inside the selection. Will try to whip up some alternative solution for isJSX
over the next few days/weeks.
These two code actions should not be offered outside js/jsx/tsx: