Skip to content

New syntax def #127

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

Closed
wants to merge 14 commits into from
11 changes: 11 additions & 0 deletions Support/PowerShell.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%YAML 1.2
---

name: PowerShell
file_extensions: [ps1]
scope: source.powershell

contexts:
main:
- match: \b(if|else|for|while)\b
scope: keyword.control.powershell
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
</dict>
<dict>
<key>match</key>
<string>(?&lt;!\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|using|var|where(?!=-object)|while)|%|\?)(?!\w)</string>
<string>(?&lt;!\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|filter|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|using|var|where(?!=-object)|while)|%|\?)(?!\w)</string>
<key>name</key>
<string>keyword.control.powershell</string>
</dict>
Expand Down Expand Up @@ -522,7 +522,7 @@
<key>function</key>
<dict>
<key>begin</key>
<string>((?i:function|filter|configuration|workflow))\s+((?:\p{L}|\d|_|-|\.)+)</string>
<string>((?i:function|configuration|workflow))\s+((?:\p{L}|\d|_|-|\.)+)</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter belongs here, I believe

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've messed this up. This change wasn't supposed to end up here. I'll try to fix it later.

<key>beginCaptures</key>
<dict>
<key>0</key>
Expand Down
5 changes: 5 additions & 0 deletions Support/syntax_test_PowerShell.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SYNTAX TEST "Packages/PowerShell/Support/PowerShell.sublime-syntax"
$null
# <- source.powershell
if ($True) { "huzza!" }
# <- keyword.control.powershell