Open yfzhao20 opened 3 years ago
I think I came up with a quick solution to your second question. Here is a preview of the unconcealed code and the concealed code: Unconcealed Concealed
Here's something you can copy and paste. (Note: I used the return carriage metacharacter \r
as a null character even though it's not really a null character. In my testing so far it seems to be okay and basically just replaces the ugly
text with 'nothing')
{ "ugly": "(?:\\\\frac{)", "pretty": "("},
{ "ugly": "(?<=\\\\frac{[^}]+)}", "pretty": "\r"},
{ "ugly": "(?<=\\\\frac{[^}]+}){", "pretty": ") / ("},
{ "ugly": "(?<=\\\\frac{[^}]+}{[^}]+)}", "pretty": ")"},
Updated version: fraction (no parentheses) e.g. \frac{x}{y} --> x / y
{ "ugly": "(?:\\\\frac{)(?=[^} ]+})", "pretty": "\r"},
{ "ugly": "(?<=\\\\frac{[^} ]+)}", "pretty": "/"},
{ "ugly": "(?<=\\\\frac{[^}]+}){(?=[^ }]+})", "pretty": "\r"},
{ "ugly": "(?<=\\\\frac{[^}]+}{[^} ]+)}", "pretty": "\r"},
fraction (with parentheses) e.g. \frac{x + y}{w + z} --> (x + y) / (w + z)
{ "ugly": "(?:\\\\frac{)(?=[^}]+})", "pretty": "("},
{ "ugly": "(?<=\\\\frac{[^}]+)}", "pretty": ") /"},
{ "ugly": "(?<=\\\\frac{[^}]+}){(?=[^}]+})", "pretty": " ("},
{ "ugly": "(?<=\\\\frac{[^}]+}{[^}]+)}", "pretty": ")"}
e.g. becomes
WOW, it works! Thank you so much😃
setting.json
to have a better pattern, my file usually changes into messy code. I have to restart my VSCode and everything works.like that:
and after I restart my VSCode, it goes:
every time I change my
setting.json
, I have to restart that😂ugly
pattern topretty
pattern, such as change\frac{xxx}{yyy}
to(xxx)/(yyy)
. That means I have to use regular expression to capturexxx
andyyy
.However when I use
()
to capture that and save, my file changes into messy code. and when I use$1
to extract the string I captured, It appears that nothing had happened.so what should I do to achieve that? Or is this the bug of the extension?