{"id":28415,"library":"tree-sitter-powershell","title":"tree-sitter-powershell","description":"A PowerShell grammar for tree-sitter, providing robust parsing of PowerShell scripts (including PowerShell 5.1 and PowerShell 7+). Current version 0.26.4, requires Python >=3.10. Released from https://github.com/airbus-cert/tree-sitter-powershell.","status":"active","version":"0.26.4","language":"python","source_language":"en","source_url":"https://github.com/airbus-cert/tree-sitter-powershell","tags":["powershell","tree-sitter","parsing"],"install":[{"cmd":"pip install tree-sitter-powershell","lang":"bash","label":"Install"}],"dependencies":[{"reason":"Runtime dependency for tree-sitter bindings","package":"tree-sitter","optional":false}],"imports":[{"note":"In v0.20+, the grammar exposes 'language' directly, not a Language class.","wrong":"from tree_sitter_powershell import Language","symbol":"language","correct":"from tree_sitter_powershell import language"}],"quickstart":{"code":"from tree_sitter import Language, Parser\nfrom tree_sitter_powershell import language\n\nPS_LANGUAGE = Language(language())\nparser = Parser(PS_LANGUAGE)\n\ntree = parser.parse(b\"Write-Host 'Hello, World!'\")\nprint(tree.root_node.sexp())","lang":"python","description":"Parses a PowerShell snippet and prints the s-expression of the AST."},"warnings":[{"fix":"Use `Language(language())` instead of `Language(language)`.","message":"The grammar object is a callable that returns a language pointer. Use `language()` (not just `language`) when passing to `Language()` constructor.","severity":"gotcha","affected_versions":">=0.20.0"},{"fix":"Update imports to `from tree_sitter_powershell import language`.","message":"In version 0.20+, the import path changed: `from tree_sitter_powershell import language` replaces the old `from tree_sitter_powershell import Language` (where Language was a class).","severity":"breaking","affected_versions":">=0.20.0"},{"fix":"Upgrade to >=0.20.0 and use the new `language()` function.","message":"The old `Language` class from tree-sitter-powershell <=0.19 is deprecated and may be removed.","severity":"deprecated","affected_versions":"<=0.19"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use `Language(language())`.","cause":"Passing the `language` function directly to `Language()` instead of calling it.","error":"TypeError: expected Language, got function"},{"fix":"Use `from tree_sitter_powershell import language` and then `Language(language())`.","cause":"The `Language` class was removed in v0.20+.","error":"ImportError: cannot import name 'Language' from 'tree_sitter_powershell'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}