{"action":"created","issue":{"url":"https://api.github.com/repos/atom/language-python/issues/257","repository_url":"https://api.github.com/repos/atom/language-python","labels_url":"https://api.github.com/repos/atom/language-python/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/atom/language-python/issues/257/comments","events_url":"https://api.github.com/repos/atom/language-python/issues/257/events","html_url":"https://github.com/atom/language-python/pull/257","id":318683377,"number":257,"title":"Add more detailed scopes to the tree-sitter grammar","user":{"login":"ambv","id":55281,"avatar_url":"https://avatars1.githubusercontent.com/u/55281?v=4","gravatar_id":"","url":"https://api.github.com/users/ambv","html_url":"https://github.com/ambv","followers_url":"https://api.github.com/users/ambv/followers","following_url":"https://api.github.com/users/ambv/following{/other_user}","gists_url":"https://api.github.com/users/ambv/gists{/gist_id}","starred_url":"https://api.github.com/users/ambv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambv/subscriptions","organizations_url":"https://api.github.com/users/ambv/orgs","repos_url":"https://api.github.com/users/ambv/repos","events_url":"https://api.github.com/users/ambv/events{/privacy}","received_events_url":"https://api.github.com/users/ambv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-29T02:06:07Z","updated_at":"2018-04-30T17:06:01Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/atom/language-python/pulls/257","html_url":"https://github.com/atom/language-python/pull/257","diff_url":"https://github.com/atom/language-python/pull/257.diff","patch_url":"https://github.com/atom/language-python/pull/257.patch"},"body":"I made changes to tree-sitter-python.cson to enable better highlighting. This includes:\r\n\r\n- fixing keywords from all being passed \"keyword.control\" scope\r\n- fixing numerals from being treated as language constants\r\n- adding missing keywords (nonlocal, global, del)\r\n- removing deprecated keywords (exec, python) which are regular functions in Python 3\r\n- adding punctuation as its own class\r\n- adding missing operators (`**`, `//`, `@`, comparisons and assignment)\r\n\r\n### Scope names\r\n\r\nI used scope names from python.cson so that themes are automatically compatible without changes. Let me know if you'd like different names.\r\n\r\n### Builtin functions/exceptions don't work yet\r\n\r\nThe builtin functions and exceptions are a useful feature in Python code. Unfortunately, it appears that currently the scope is not applied to them. I left what I tried in the pull request but this requires some changes to actually work.\r\n\r\nI'm not sure how to even debug this as Atom is not actually scopes with Tree Sitter enabled (it's showing the syntax tree at cursor).\r\n\r\nBuiltin functions and exceptions are rather easily generated from Python (the names are present in the `builtins` module, the ones that are subclasses of BaseException are exceptions, others are functions). It should be relatively easy to keep this in sync in the future.\r\n\r\n### There are no tests\r\n\r\nI'd like to use @kevinastone's Atom-Grammar-Test for it once #254 lands. I can do that as a separate pull request later."},"comment":{"url":"https://api.github.com/repos/atom/language-python/issues/comments/385463033","html_url":"https://github.com/atom/language-python/pull/257#issuecomment-385463033","issue_url":"https://api.github.com/repos/atom/language-python/issues/257","id":385463033,"user":{"login":"maxbrunsfeld","id":326587,"avatar_url":"https://avatars3.githubusercontent.com/u/326587?v=4","gravatar_id":"","url":"https://api.github.com/users/maxbrunsfeld","html_url":"https://github.com/maxbrunsfeld","followers_url":"https://api.github.com/users/maxbrunsfeld/followers","following_url":"https://api.github.com/users/maxbrunsfeld/following{/other_user}","gists_url":"https://api.github.com/users/maxbrunsfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/maxbrunsfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxbrunsfeld/subscriptions","organizations_url":"https://api.github.com/users/maxbrunsfeld/orgs","repos_url":"https://api.github.com/users/maxbrunsfeld/repos","events_url":"https://api.github.com/users/maxbrunsfeld/events{/privacy}","received_events_url":"https://api.github.com/users/maxbrunsfeld/received_events","type":"User","site_admin":true},"created_at":"2018-04-30T17:06:01Z","updated_at":"2018-04-30T17:06:01Z","author_association":"CONTRIBUTOR","body":"> There are no tests. I'd like to use `@kevinastone`'s Atom-Grammar-Test for it once #254 lands. I can do that as a separate pull request later.\r\n\r\nWe could use `atom-grammar-test`, but we'd have to modify it a bit to support the Tree-sitter based highlighting.\r\n\r\nThe actual parsing is tested quite exhaustively by the `tree-sitter-python` test suite, and `tree-sitter-python.cson` file in this repo is pretty declarative, so I don't think that we necessarily need additional tests at this layer, but I'd be ok adding them if you feel they'd add value."}}
{"actor":{"display_login":"maxbrunsfeld"}}