-
Notifications
You must be signed in to change notification settings - Fork 49
grammar freezes #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This line has catastrophic backtracking: EditorSyntax/PowerShellSyntax.tmLanguage Line 629 in 472c944
Changing the * to ? symbol seems to work. |
The difference between the two versions was I will push that ASAP. |
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 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 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. "commentEmbeddedDocs": {
"patterns": [
{
"captures": {
"1": {
"name": "constant.string.documentation.powershell"
},
"2": {
"name": "keyword.operator.documentation.powershell"
}
},
"match": "^(?i:\\s*(\\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "constant.string.documentation.powershell"
},
"2": {
"name": "keyword.operator.documentation.powershell"
},
"3": {
"name": "keyword.operator.documentation.powershell"
}
},
"match": "^(?i:\\s*(\\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\\s+([a-z0-9-_]+))",
"name": "comment.documentation.embedded.powershell"
}
]
},
"slCommentEmbeddedDocs": {
"patterns": [
{
"captures": {
"1": {
"name": "constant.string.documentation.powershell"
},
"2": {
"name": "keyword.operator.documentation.powershell"
}
},
"match": "\\G(?i:#*\\s*(\\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "constant.string.documentation.powershell"
},
"2": {
"name": "keyword.operator.documentation.powershell"
},
"3": {
"name": "keyword.operator.documentation.powershell"
}
},
"match": "\\G(?i:#*\\s*(\\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\\s+([a-z0-9-_]+))",
"name": "comment.documentation.embedded.powershell"
}
]
} (JSON from VS Code) |
Quick correction: The |
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 Edited to add '*' after '\s' |
@msftrncs probably should open a separate issue to track that. |
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. |
Opening this file freezes with the latest grammar.
I reverted the VSCode grammar to 6f54386
The text was updated successfully, but these errors were encountered: