Uh oh!
There was an error while loading. Please reload this page.
Add missing scopes for correct symbol navigation - #189
Conversation
This enables Sublime Text to correctly find references to functions being called, at least for functions written according to the recommended style.
Static and instance methods are now identified as functions. F12 and shift+F12 can now correctly find definitions and references of class methods.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
matteocoder
commented
Jan 11, 2025
@deathaxe thank you for your feedback. Is the C syntax file a good start to learn how to properly apply scopes to functions? |
C also requires some refactoring to make use of latest best practices. Better use Java or PHP. Maybe Batch or ShellScript may also provide some inspiration as they are of same language family. I haven't analyzed PowerShell syntax too much, but my hunch is it possibly still requiring significant work to get to Bash/Zsh quality of parsing/scoping expressions. Especially its support of C# blocks may provide some extra challenges to not run into issues with exotic scripts. |
matteocoder
commented
Jan 11, 2025
I see. Would you still be comfortable merging in these changes once I fix the tests, at least to provide basic working support for symbol search and navigation? |
deathaxe
commented
Jan 11, 2025
Anything which improves this syntax is welcome. A major overhaul like for Bash etc. may not take place in the near future. |
deathaxe
commented
Jan 11, 2025
Note: You proabably want/need to merge master branch into your PR to receive latest CI syntax test fixes. |
* master: Fix syntax test action (SublimeText#190) (Re-)add PowerShell 6+ number suffixes
matteocoder
commented
Jan 11, 2025
@deathaxe sure! In this case, the CI complains about the missing definitions of commands like "Invoke-Something" and "Test-Path". Should I write dummy definitions like functionInvoke-Something {}Or should I leave those tests be? |
Uh oh!
There was an error while loading. Please reload this page.
michaelblyons
commented
Jan 11, 2025
@matteocoder if you're still looking for flaws to correct, some missing functionality is mentioned in various posts on #165 |
matteocoder
commented
Jan 12, 2025
@michaelblyons thank you for pointing me to thee issue. I want to thank you all for the remarkable job you did with the syntax. Having it rewritten in YAML and become more tightly integrated with the plugin gave me the confidence to start contributing. |
I added a
meta.function-callscope to the command context, so that references to commands written in the recommended PowerShell style can be found by using shift+F12I also added a new syntax context for class methods, so that instance and static method definitions are marked as functions. Similarly, this change allows F12 and shift+F12 to work correctly for methods.