vscode-leetcode icon indicating copy to clipboard operation
vscode-leetcode copied to clipboard

parseDescription using regex

Open csalg opened this issue 4 years ago • 1 comments

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:

  1. 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.
  2. It assumes that the string can be empty or formatting might change and will not break under those circumstances, instead providing some defaults.

csalg avatar Oct 26 '21 07:10 csalg

Additionally, I wrote two regression tests but I am not sure what to do with them. Is there a different repo with tests?

csalg avatar Oct 26 '21 07:10 csalg