microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
185 stars 55 forks source link

Preprocess multiple consecutive dashes which hang regexp engine #413

Closed andreeis closed 1 year ago

andreeis commented 1 year ago

Fix for bug https://github.com/microsoft/vscode-makefile-tools/issues/106. I was not able to find a way in typescript to timeout or guard the regexp run of exec API. Also I did not think it was worth to create a thread that would run regexp from terminal as a command and kill it when needed. Instead I am removing the problematic pattern: changing "-------" into "- - - - - - ". I am not removing completely the pattern just so the intermediate preprocessed text looks somewhat similar to the original regarding these lines which usually serve as separation or layout... The "- - - " does not hang or slow down the regexp.exec api.