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
First of all, I want to share some highlights of the recent release 2.1.0
New unit test framework allows describe fundamental rules about syntax scopes. Now ST scopes can be compared to tokens, produced by PS parser (used for powershell_ise and PSReadLine highlighting). Credits to @guillermooo for introducing unit tests.
Tons of bugfixes for syntax. Credits to @bcrotty for his contribution. Credits to @Jaykul for his contribution for previous release 2.0.0 and support for PS v3.
Github syntax highlight library will use our work for all github powershell code! I don't have information when it will happen, but eventually we will impact experience for all open source powershell developers. I'm quite excited about it.
For next release, there are few areas where we can improve.
Better test automation to reduce risk of regressions. Currently, unit tests have quite few ignored errors.
Excellent @vors! Thanks for taking the lead here :)
Generally speaking, I think it'd be worth adding the ability of running PS code from ST. For example, PowershellUtils lets you write a short script and have the output populate each ST text region in the buffer.
Also, perhaps this package could expose some sort of command/api so that other packages can execute PS code. For instance, I'd like Vintageous (Vim emulation) to use PowerShell as a shell language for some Vim commands.
Anyway, nothing too specific, just throwing some ideas around.
@jugglingnutcase is the author of PowerShell laguage package for atom text editor. (btw, 4k downloads). Atom and SublimeText share the same grammar, and he is considering using our repo as a vendor submodule for grammar.
His package also has a pretty big unit test coverage, which we can leverage.
I want to talk about tests a little bit more. When I prepared pull request to lingust, I spent some time fixing grammar to be compatible with https://lightshow.githubapp.com/. You can see changes in PR #75. Since now we have github as a customer, we should make sure that linguist library works well with all new releases. Same for atom. We may want make grammar unit testing environment-agnostic: run it outside of SublimeText. Maybe lingust lib has some infrastructure for that.
We can think about sharing other features (goto symbol, snippets) between two editors.
⚠️ i often don't know what i'm talking about and i'm doing this quick, so i may not be very clear atm ⚠️
i'm 👍 for making the grammar unit testing environment-agnostic, but i'm not sure which platform is best for that. i don't know how SublimeText deals with the grammar files... is there a library they're using for that that is open source that we could use for automated testing? i know very little python so if it's python, i'll need lots of help.
Since i'm biased 😉, i suggest that we utilize node and npm for our tests. There's a bunch of benefits to that:
good cross-platform support via node/npm
js is fairly approachable and can make it easier for current and future contributers
converting between the plist and js is pretty simple and i already have code doing this
we can use tests i've already written (after adjusting them for this new grammar)
apm and Atom's grammar library (first-mate) are both on npm (apm on npm & first-mate on npm) so that makes them easy to pull down in isolation for automated testing.
i'm not sure how to test how the grammar will behave in other environments, though it looks like GitHub.com will act similarly to Atom because they both are based on textmate for grammars.
@jugglingnutcase As far as I know sublime exposes all APIs via sublime.py module which calls sublime_api.py (native code). To get grammar scopes you need to 1) load sublime.py (I don't know how to do it outside of sublime) 2) Call set_syntax_file() 3) call some api to get scopes like find_by_selector.
Let me tell you a little bit more about our current tests. There are currently two types: in-proc tests, there are very few of them. And out-of-proc pester tests. By proc I mean sublime text process. Out-of-proc tests consume text files, produced by specific in-proc tests, that describes scopes. The reason to make them out-of-proc is to use tokens, generated by PowerShell parser as canonical scopes. So we can make sure that not only particular inputs produce pre-determined scopes, but we can verify fundamental principals for scopes against language parser. Currently there are 3 such principles (in release 2.1.0).
Scopes should be the same for input and for input.ToUpper()
Scopes should be the same for input and for input.ToLower()
Scopes should not break powershell parser tokens apart. Sample from a bug, fixed in 2.1.0 Get-Not should not be highlighted as Get** and -Not**.
First two doesn't really require PowerShell parser tokens, but I tested them out-of-proc for consistency.
There are two directions that I'm personally interested in:
Continue work on grammar
a. Leverage atom tests
b. Test grammar completely out-of-proc.
c. Fix bugs, provide go-to definition (can it be shared with atom?).
I don't know yet. But I don't want sacrifice test coverage without good reason. Good reason can be that old tests are completely irrelevant with new grammar.
PowerShell/Pester was picked semi-randomly. It's a convenient and cheap way to call parser API. But it could be C# or F# as well. PowerShell is not my top-choice for writing big things.
But one advantage or writing tests in PowerShell is dogfooding. Also it's very likely that anybody who want to run them will have everything on the box already. Except maybe pester, but it's a one command to install from PowerShellGet, PSGet or chocolaty.
Thanks for the offer of help, @vors! i've been slow to merge in my PR using this grammar. All i have left is to fix up my tests, which i think i'll do on my side and then i can adjust things as our testing processes develop. i'll try to get to that within the next week or two.
Activity
guillermooo commentedon Jan 29, 2015
Excellent @vors! Thanks for taking the lead here :)
Generally speaking, I think it'd be worth adding the ability of running PS code from ST. For example, PowershellUtils lets you write a short script and have the output populate each ST text region in the buffer.
Also, perhaps this package could expose some sort of command/api so that other packages can execute PS code. For instance, I'd like Vintageous (Vim emulation) to use PowerShell as a shell language for some Vim commands.
Anyway, nothing too specific, just throwing some ideas around.
vors commentedon Jan 29, 2015
@guillermooo excellent ideas!
vors commentedon Jan 31, 2015
I also was thinking about a color schema that supports all PowerShell scopes. It can be in colors of ISE :)
bcrotty commentedon Feb 2, 2015
I've had the same idea lately! I really like the color theory and thought that went into creating Solarized (although the theme itself is not my first choice). http://ethanschoonover.com/solarized
vors commentedon Feb 3, 2015
btw, github already use our grammar for all PS code!
guillermooo commentedon Feb 3, 2015
👏 😎
vors commentedon Feb 3, 2015
More exciting news!
@jugglingnutcase is the author of PowerShell laguage package for atom text editor. (btw, 4k downloads). Atom and SublimeText share the same grammar, and he is considering using our repo as a vendor submodule for grammar.
His package also has a pretty big unit test coverage, which we can leverage.
I want to talk about tests a little bit more. When I prepared pull request to lingust, I spent some time fixing grammar to be compatible with https://lightshow.githubapp.com/. You can see changes in PR #75. Since now we have github as a customer, we should make sure that linguist library works well with all new releases. Same for atom. We may want make grammar unit testing environment-agnostic: run it outside of SublimeText. Maybe lingust lib has some infrastructure for that.
We can think about sharing other features (goto symbol, snippets) between two editors.
jrsconfitto commentedon Feb 4, 2015
i'll throw my thoughts out there.
i'm 👍 for making the grammar unit testing environment-agnostic, but i'm not sure which platform is best for that. i don't know how SublimeText deals with the grammar files... is there a library they're using for that that is open source that we could use for automated testing? i know very little python so if it's python, i'll need lots of help.
Since i'm biased 😉, i suggest that we utilize node and npm for our tests. There's a bunch of benefits to that:
i'm not sure how to test how the grammar will behave in other environments, though it looks like GitHub.com will act similarly to Atom because they both are based on textmate for grammars.
vors commentedon Feb 5, 2015
@jugglingnutcase As far as I know sublime exposes all APIs via
sublime.pymodule which callssublime_api.py(native code). To get grammar scopes you need to 1) load sublime.py (I don't know how to do it outside of sublime) 2) Callset_syntax_file()3) call some api to get scopes likefind_by_selector.Let me tell you a little bit more about our current tests. There are currently two types: in-proc tests, there are very few of them. And out-of-proc pester tests. By proc I mean sublime text process. Out-of-proc tests consume text files, produced by specific in-proc tests, that describes scopes. The reason to make them out-of-proc is to use tokens, generated by PowerShell parser as canonical scopes. So we can make sure that not only particular inputs produce pre-determined scopes, but we can verify fundamental principals for scopes against language parser. Currently there are 3 such principles (in release 2.1.0).
inputand forinput.ToUpper()inputand forinput.ToLower()Get-Notshould not be highlighted asGet**and-Not**.First two doesn't really require PowerShell parser tokens, but I tested them out-of-proc for consistency.
vors commentedon Feb 5, 2015
There are two directions that I'm personally interested in:
Continue work on grammar
a. Leverage atom tests
b. Test grammar completely out-of-proc.
c. Fix bugs, provide go-to definition (can it be shared with atom?).
Create a proof-of-concept prototype: SublimeText-powershell as an alternative for powershell_ise
a. I want to be able to open special kind of tab: powershell REPL, with expirience, similar to powershell_ise.
b. We probably need to implement custom powershell host for that or implement scraping of existing host (can be harder).
c. Ideally think about project similar to http://www.omnisharp.net/
What do you think about it?
jrsconfitto commentedon Feb 5, 2015
Interesting. i'll have to take a closer look at the tests in this project to make sure i understand what's going on.
i like the directions you're considering, those sound like really useful things.
How do you see this working out? Translating them to the pester tests you have?
vors commentedon Feb 5, 2015
I don't know yet. But I don't want sacrifice test coverage without good reason. Good reason can be that old tests are completely irrelevant with new grammar.
PowerShell/Pester was picked semi-randomly. It's a convenient and cheap way to call parser API. But it could be C# or F# as well. PowerShell is not my top-choice for writing big things.
But one advantage or writing tests in PowerShell is dogfooding. Also it's very likely that anybody who want to run them will have everything on the box already. Except maybe pester, but it's a one command to install from PowerShellGet, PSGet or chocolaty.
guillermooo commentedon Feb 11, 2015
Shall we create a new repo for the color scheme?
guillermooo commentedon Feb 11, 2015
We can also start with the color scheme in this repo and worry about a separate repo later.
vors commentedon Feb 26, 2015
Thank you everybody for discussion!
There are a lot of new bugs for syntax. I think we need to release 2.2.0 with fixes for them and some feature work. @guillermooo already implemented nice color schema and started work in separate repo for running PS code from ST. https://github.com/guillermooo/PowerShellConsole
I'm going to create a milestone with gols:
jrsconfitto commentedon Feb 26, 2015
Thanks for the offer of help, @vors! i've been slow to merge in my PR using this grammar. All i have left is to fix up my tests, which i think i'll do on my side and then i can adjust things as our testing processes develop. i'll try to get to that within the next week or two.
vors commentedon Feb 26, 2015
cool
vors commentedon Mar 4, 2015
Just heads up for all active contributors: @guillermooo @jugglingnutcase @bcrotty
There is a PowerShell community slack https://powershell.slack.com
You can sign-up on http://slack.poshcode.org/?utm_content=buffer8d9ad&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
I created a #sublimetext channel for discussions and visibility for community. I hope it will engage new people to contribute.