vscode-leetcode
vscode-leetcode copied to clipboard
parseDescription using regex
There are several issues open regarding parseDescription breaking the whole extension, e.g. https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/749, https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/715
The problem seems to be that vscode-leetcode-cli sometimes prepends a few lines on top of the output, which breaks the parseDescription method.
This PR addresses this issue in two ways:
- It uses regex to parse the output instead of breaking the output into lines and hardcoding in which line each property should be. This solves tthe issue of the output having lines prepended.
- It assumes that the string can be empty or formatting might change and will not break under those circumstances, instead providing some defaults.
Additionally, I wrote two regression tests but I am not sure what to do with them. Is there a different repo with tests?