You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The difference between the two versions was (?i:\s*(\.) - > ^(?i:(?:\s*|#)+(\.) reason being if you forgot a space after a sentence and had a keyword it would highlight (#119). The * has been there all along but coupled with the + that's what's doing it in. Whether you change it to ^(?i:(?:\s?|#)+(\.) or ^(?i:(?:\s*|#)(\.) the crash stops.
I see another minor problem. It appears that PowerShell Get-Help requires these documentation keywords to be the only word on the line (spaces are accepted at the end of the line, but not even '#'). (not sure if its true for all of them, PARAMETER which does accept additional text is in a different pattern) Also, I am not getting any scoping of these documentation keywords if they are on a single line comment, but PowerShell Get-Help seems to accept that. It even seems to accept <# #> # .SYNOPSIS but any other non space characters are not accepted.
Seems that it might be that the same pattern (repository?) is used for both comment types, but the match here requires being at the beginning of the line, and I am not sure if that reference is valid inside the 'include' of another pattern? I tried it, modifying my tmLanguage.json file on VS Code, copying the commentEmbeddedDocs pattern to slCommentEmbeddedDocs and removed the ^ from the match, and changed the include reference on commentLine and that seems to get the single line comment's to work (scope and color for the documentation keyword). I'm not sure how the rest of the rules can be adhered to.
trial and error seems to indicate get-help only supports spaces at the start of multi-line comments, and only accepts consecutive '#'s immediately after the start of a single line comment. I finally determined that \G would fix that.
Quick correction: The ^ should be changed to (?:^|\\G), as get-help allows the keyword on the same line as the start of the multiline comment, but with nothing other than spaces between.
and a final correction, I completely missed the first point I brought up, get-help doesn't allow anything trailing on the keyword lines that do not pass an argument for the help keyword.
Add (?:\\s*$) to the end of the matches with only two captures.
Activity
[-]grammar fresses[/-][+]grammar freezes[/+]Serega124 commentedon Aug 15, 2018
This line has catastrophic backtracking:
EditorSyntax/PowerShellSyntax.tmLanguage
Line 629 in 472c944
Changing the * to ? symbol seems to work.
via microsoft/vscode#56476
omniomi commentedon Aug 15, 2018
The difference between the two versions was
(?i:\s*(\.)- >^(?i:(?:\s*|#)+(\.)reason being if you forgot a space after a sentence and had a keyword it would highlight (#119). The*has been there all along but coupled with the+that's what's doing it in. Whether you change it to^(?i:(?:\s?|#)+(\.)or^(?i:(?:\s*|#)(\.)the crash stops.I will push that ASAP.
fix PowerShell#134
msftrncs commentedon Aug 16, 2018
I see another minor problem. It appears that PowerShell Get-Help requires these documentation keywords to be the only word on the line (spaces are accepted at the end of the line, but not even '#'). (not sure if its true for all of them, PARAMETER which does accept additional text is in a different pattern) Also, I am not getting any scoping of these documentation keywords if they are on a single line comment, but PowerShell Get-Help seems to accept that. It even seems to accept
<# #> # .SYNOPSISbut any other non space characters are not accepted.Seems that it might be that the same pattern (repository?) is used for both comment types, but the match here requires being at the beginning of the line, and I am not sure if that reference is valid inside the 'include' of another pattern? I tried it, modifying my tmLanguage.json file on VS Code, copying the
commentEmbeddedDocspattern toslCommentEmbeddedDocsand removed the^from the match, and changed the include reference oncommentLineand that seems to get the single line comment's to work (scope and color for the documentation keyword). I'm not sure how the rest of the rules can be adhered to.trial and error seems to indicate get-help only supports spaces at the start of multi-line comments, and only accepts consecutive '#'s immediately after the start of a single line comment. I finally determined that \G would fix that.
(JSON from VS Code)
msftrncs commentedon Aug 16, 2018
Quick correction: The
^should be changed to(?:^|\\G), as get-help allows the keyword on the same line as the start of the multiline comment, but with nothing other than spaces between.msftrncs commentedon Aug 16, 2018
and a final correction, I completely missed the first point I brought up, get-help doesn't allow anything trailing on the keyword lines that do not pass an argument for the help keyword.
Add
(?:\\s*$)to the end of the matches with only two captures.Edited to add '*' after '\s'
Jaykul commentedon Aug 16, 2018
Carl Morris (@msftrncs) probably should open a separate issue to track that.
msftrncs commentedon Aug 16, 2018
I was able to come up with a better solution that doesn't require an additional repository item, I'll include this all in a new issue.
fix #134 (#135)