{"action":"created","comment":{"url":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/comments/216160112","pull_request_review_id":153581956,"id":216160112,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjE2MDExMg==","diff_hunk":"@@ -2056,6 +2089,45 @@ This performs fontification according to `typescript--class-styles'.\"\n                (save-excursion\n                  (typescript--backward-syntactic-ws)\n                  (memq (char-before) '(?, ?{ ?} ?\\;)))))\n+         ;; Do not identify the symbol > if it is likely part of a type argument\n+         ;; T<A>, but identify it if it is likely a greater-than symbol. This is\n+         ;; a hard problem in the absence of semicolons, see:\n+         ;; https://github.com/ananthakumaran/typescript.el/issues/81\n+         (not (and\n+               (looking-at \">\")\n+               (save-excursion\n+                 (and\n+                  (typescript--search-backward-matching-angle-bracket 1)\n+                  ;; If we made it here, we found a candidate matching opening\n+                  ;; angle bracket. We still need to guess whether it actually\n+                  ;; is one, and not a spurious less-than operator!\n+\n+                  ;; Look backwards for the first of:\n+                  ;; - one of the symbols: = :\n+                  ;; - or a TypeScript keyword\n+                  ;; Depending on what comes first, we can make an educated\n+                  ;; guess on the nature of our \">\" of interest.\n+                  (typescript--re-search-backward (concat \"[=:]\\\\|\" typescript--keyword-re) nil t)\n+                  (or\n+                   ;; If the previous keyword is \"as\", definitely a type.\n+                   (when (looking-at (typescript--regexp-opt-symbol '(\"as\"))) t)","path":"typescript-mode.el","position":65,"original_position":65,"commit_id":"0251f1c4279d973ff3a972417444d4fac64fed56","original_commit_id":"0251f1c4279d973ff3a972417444d4fac64fed56","user":{"login":"lddubeau","id":1963493,"node_id":"MDQ6VXNlcjE5NjM0OTM=","avatar_url":"https://avatars3.githubusercontent.com/u/1963493?v=4","gravatar_id":"","url":"https://api.github.com/users/lddubeau","html_url":"https://github.com/lddubeau","followers_url":"https://api.github.com/users/lddubeau/followers","following_url":"https://api.github.com/users/lddubeau/following{/other_user}","gists_url":"https://api.github.com/users/lddubeau/gists{/gist_id}","starred_url":"https://api.github.com/users/lddubeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lddubeau/subscriptions","organizations_url":"https://api.github.com/users/lddubeau/orgs","repos_url":"https://api.github.com/users/lddubeau/repos","events_url":"https://api.github.com/users/lddubeau/events{/privacy}","received_events_url":"https://api.github.com/users/lddubeau/received_events","type":"User","site_admin":false},"body":"Prior to your commit, all calls to `typescript--regexp-opt-symbol` are made in the initialization of global variables. And elsewhere the regexps are just constructed manually. I'd rather keep it that way and avoid the call in code that performs performance sensitive tasks. From time to time I have to use modes that are slow at indentation. I definitely notice when Emacs has to pause to indent my line.\r\n\r\nHere you can easily replace `(typescript--regexp-opt-symbol '(\"as\"))` with `\\\\_<as\\\\_>`","created_at":"2018-09-09T15:05:51Z","updated_at":"2018-09-09T15:48:12Z","html_url":"https://github.com/ananthakumaran/typescript.el/pull/82#discussion_r216160112","pull_request_url":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/comments/216160112"},"html":{"href":"https://github.com/ananthakumaran/typescript.el/pull/82#discussion_r216160112"},"pull_request":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82","id":212179356,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMTc5MzU2","html_url":"https://github.com/ananthakumaran/typescript.el/pull/82","diff_url":"https://github.com/ananthakumaran/typescript.el/pull/82.diff","patch_url":"https://github.com/ananthakumaran/typescript.el/pull/82.patch","issue_url":"https://api.github.com/repos/ananthakumaran/typescript.el/issues/82","number":82,"state":"open","locked":false,"title":"Distinguish type arguments vs less/greater, fixes #81","user":{"login":"Ptival","id":478606,"node_id":"MDQ6VXNlcjQ3ODYwNg==","avatar_url":"https://avatars3.githubusercontent.com/u/478606?v=4","gravatar_id":"","url":"https://api.github.com/users/Ptival","html_url":"https://github.com/Ptival","followers_url":"https://api.github.com/users/Ptival/followers","following_url":"https://api.github.com/users/Ptival/following{/other_user}","gists_url":"https://api.github.com/users/Ptival/gists{/gist_id}","starred_url":"https://api.github.com/users/Ptival/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ptival/subscriptions","organizations_url":"https://api.github.com/users/Ptival/orgs","repos_url":"https://api.github.com/users/Ptival/repos","events_url":"https://api.github.com/users/Ptival/events{/privacy}","received_events_url":"https://api.github.com/users/Ptival/received_events","type":"User","site_admin":false},"body":"As explained in #81, the current indentation fails to discern type arguments like `t < a , b > ...` from comparison operators separated by commas like `t < a , b > ...`.\r\n\r\nIt is a somewhat hard problem to solve using only regular-expressions, yet, this patch solves all of the tricky examples listed in #81, many of which are, honestly, code that should not be written without parentheses!\r\n\r\nSo this patch:\r\n- keeps all existing good behaviors\r\n- patches most (all?) bad behaviors for reasonable code\r\n- patches many(?) bad behaviors for unreasonable code\r\n\r\nAnd I've kept it short and documented, so that it should not become a maintenance burden.\r\n\r\nCheers!","created_at":"2018-08-30T19:01:43Z","updated_at":"2018-09-09T15:48:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"892f18ad1aae264ae7fd03e4a599b2734fe2ef04","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82/commits","review_comments_url":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82/comments","review_comment_url":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ananthakumaran/typescript.el/issues/82/comments","statuses_url":"https://api.github.com/repos/ananthakumaran/typescript.el/statuses/0251f1c4279d973ff3a972417444d4fac64fed56","head":{"label":"Ptival:master","ref":"master","sha":"0251f1c4279d973ff3a972417444d4fac64fed56","user":{"login":"Ptival","id":478606,"node_id":"MDQ6VXNlcjQ3ODYwNg==","avatar_url":"https://avatars3.githubusercontent.com/u/478606?v=4","gravatar_id":"","url":"https://api.github.com/users/Ptival","html_url":"https://github.com/Ptival","followers_url":"https://api.github.com/users/Ptival/followers","following_url":"https://api.github.com/users/Ptival/following{/other_user}","gists_url":"https://api.github.com/users/Ptival/gists{/gist_id}","starred_url":"https://api.github.com/users/Ptival/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ptival/subscriptions","organizations_url":"https://api.github.com/users/Ptival/orgs","repos_url":"https://api.github.com/users/Ptival/repos","events_url":"https://api.github.com/users/Ptival/events{/privacy}","received_events_url":"https://api.github.com/users/Ptival/received_events","type":"User","site_admin":false},"repo":{"id":146679032,"node_id":"MDEwOlJlcG9zaXRvcnkxNDY2NzkwMzI=","name":"typescript.el","full_name":"Ptival/typescript.el","owner":{"login":"Ptival","id":478606,"node_id":"MDQ6VXNlcjQ3ODYwNg==","avatar_url":"https://avatars3.githubusercontent.com/u/478606?v=4","gravatar_id":"","url":"https://api.github.com/users/Ptival","html_url":"https://github.com/Ptival","followers_url":"https://api.github.com/users/Ptival/followers","following_url":"https://api.github.com/users/Ptival/following{/other_user}","gists_url":"https://api.github.com/users/Ptival/gists{/gist_id}","starred_url":"https://api.github.com/users/Ptival/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ptival/subscriptions","organizations_url":"https://api.github.com/users/Ptival/orgs","repos_url":"https://api.github.com/users/Ptival/repos","events_url":"https://api.github.com/users/Ptival/events{/privacy}","received_events_url":"https://api.github.com/users/Ptival/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Ptival/typescript.el","description":null,"fork":true,"url":"https://api.github.com/repos/Ptival/typescript.el","forks_url":"https://api.github.com/repos/Ptival/typescript.el/forks","keys_url":"https://api.github.com/repos/Ptival/typescript.el/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ptival/typescript.el/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ptival/typescript.el/teams","hooks_url":"https://api.github.com/repos/Ptival/typescript.el/hooks","issue_events_url":"https://api.github.com/repos/Ptival/typescript.el/issues/events{/number}","events_url":"https://api.github.com/repos/Ptival/typescript.el/events","assignees_url":"https://api.github.com/repos/Ptival/typescript.el/assignees{/user}","branches_url":"https://api.github.com/repos/Ptival/typescript.el/branches{/branch}","tags_url":"https://api.github.com/repos/Ptival/typescript.el/tags","blobs_url":"https://api.github.com/repos/Ptival/typescript.el/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ptival/typescript.el/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ptival/typescript.el/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ptival/typescript.el/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ptival/typescript.el/statuses/{sha}","languages_url":"https://api.github.com/repos/Ptival/typescript.el/languages","stargazers_url":"https://api.github.com/repos/Ptival/typescript.el/stargazers","contributors_url":"https://api.github.com/repos/Ptival/typescript.el/contributors","subscribers_url":"https://api.github.com/repos/Ptival/typescript.el/subscribers","subscription_url":"https://api.github.com/repos/Ptival/typescript.el/subscription","commits_url":"https://api.github.com/repos/Ptival/typescript.el/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ptival/typescript.el/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ptival/typescript.el/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ptival/typescript.el/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ptival/typescript.el/contents/{+path}","compare_url":"https://api.github.com/repos/Ptival/typescript.el/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ptival/typescript.el/merges","archive_url":"https://api.github.com/repos/Ptival/typescript.el/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ptival/typescript.el/downloads","issues_url":"https://api.github.com/repos/Ptival/typescript.el/issues{/number}","pulls_url":"https://api.github.com/repos/Ptival/typescript.el/pulls{/number}","milestones_url":"https://api.github.com/repos/Ptival/typescript.el/milestones{/number}","notifications_url":"https://api.github.com/repos/Ptival/typescript.el/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ptival/typescript.el/labels{/name}","releases_url":"https://api.github.com/repos/Ptival/typescript.el/releases{/id}","deployments_url":"https://api.github.com/repos/Ptival/typescript.el/deployments","created_at":"2018-08-30T01:27:42Z","updated_at":"2018-09-08T00:25:57Z","pushed_at":"2018-09-08T00:25:55Z","git_url":"git://github.com/Ptival/typescript.el.git","ssh_url":"git@github.com:Ptival/typescript.el.git","clone_url":"https://github.com/Ptival/typescript.el.git","svn_url":"https://github.com/Ptival/typescript.el","homepage":null,"size":264,"stargazers_count":0,"watchers_count":0,"language":"Emacs Lisp","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ananthakumaran:master","ref":"master","sha":"7c6fd0f4a8f32fdda3eecbd423a124302cfcfcf5","user":{"login":"ananthakumaran","id":149238,"node_id":"MDQ6VXNlcjE0OTIzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/149238?v=4","gravatar_id":"","url":"https://api.github.com/users/ananthakumaran","html_url":"https://github.com/ananthakumaran","followers_url":"https://api.github.com/users/ananthakumaran/followers","following_url":"https://api.github.com/users/ananthakumaran/following{/other_user}","gists_url":"https://api.github.com/users/ananthakumaran/gists{/gist_id}","starred_url":"https://api.github.com/users/ananthakumaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ananthakumaran/subscriptions","organizations_url":"https://api.github.com/users/ananthakumaran/orgs","repos_url":"https://api.github.com/users/ananthakumaran/repos","events_url":"https://api.github.com/users/ananthakumaran/events{/privacy}","received_events_url":"https://api.github.com/users/ananthakumaran/received_events","type":"User","site_admin":false},"repo":{"id":37014379,"node_id":"MDEwOlJlcG9zaXRvcnkzNzAxNDM3OQ==","name":"typescript.el","full_name":"ananthakumaran/typescript.el","owner":{"login":"ananthakumaran","id":149238,"node_id":"MDQ6VXNlcjE0OTIzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/149238?v=4","gravatar_id":"","url":"https://api.github.com/users/ananthakumaran","html_url":"https://github.com/ananthakumaran","followers_url":"https://api.github.com/users/ananthakumaran/followers","following_url":"https://api.github.com/users/ananthakumaran/following{/other_user}","gists_url":"https://api.github.com/users/ananthakumaran/gists{/gist_id}","starred_url":"https://api.github.com/users/ananthakumaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ananthakumaran/subscriptions","organizations_url":"https://api.github.com/users/ananthakumaran/orgs","repos_url":"https://api.github.com/users/ananthakumaran/repos","events_url":"https://api.github.com/users/ananthakumaran/events{/privacy}","received_events_url":"https://api.github.com/users/ananthakumaran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ananthakumaran/typescript.el","description":null,"fork":false,"url":"https://api.github.com/repos/ananthakumaran/typescript.el","forks_url":"https://api.github.com/repos/ananthakumaran/typescript.el/forks","keys_url":"https://api.github.com/repos/ananthakumaran/typescript.el/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ananthakumaran/typescript.el/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ananthakumaran/typescript.el/teams","hooks_url":"https://api.github.com/repos/ananthakumaran/typescript.el/hooks","issue_events_url":"https://api.github.com/repos/ananthakumaran/typescript.el/issues/events{/number}","events_url":"https://api.github.com/repos/ananthakumaran/typescript.el/events","assignees_url":"https://api.github.com/repos/ananthakumaran/typescript.el/assignees{/user}","branches_url":"https://api.github.com/repos/ananthakumaran/typescript.el/branches{/branch}","tags_url":"https://api.github.com/repos/ananthakumaran/typescript.el/tags","blobs_url":"https://api.github.com/repos/ananthakumaran/typescript.el/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ananthakumaran/typescript.el/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ananthakumaran/typescript.el/git/refs{/sha}","trees_url":"https://api.github.com/repos/ananthakumaran/typescript.el/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ananthakumaran/typescript.el/statuses/{sha}","languages_url":"https://api.github.com/repos/ananthakumaran/typescript.el/languages","stargazers_url":"https://api.github.com/repos/ananthakumaran/typescript.el/stargazers","contributors_url":"https://api.github.com/repos/ananthakumaran/typescript.el/contributors","subscribers_url":"https://api.github.com/repos/ananthakumaran/typescript.el/subscribers","subscription_url":"https://api.github.com/repos/ananthakumaran/typescript.el/subscription","commits_url":"https://api.github.com/repos/ananthakumaran/typescript.el/commits{/sha}","git_commits_url":"https://api.github.com/repos/ananthakumaran/typescript.el/git/commits{/sha}","comments_url":"https://api.github.com/repos/ananthakumaran/typescript.el/comments{/number}","issue_comment_url":"https://api.github.com/repos/ananthakumaran/typescript.el/issues/comments{/number}","contents_url":"https://api.github.com/repos/ananthakumaran/typescript.el/contents/{+path}","compare_url":"https://api.github.com/repos/ananthakumaran/typescript.el/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ananthakumaran/typescript.el/merges","archive_url":"https://api.github.com/repos/ananthakumaran/typescript.el/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ananthakumaran/typescript.el/downloads","issues_url":"https://api.github.com/repos/ananthakumaran/typescript.el/issues{/number}","pulls_url":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls{/number}","milestones_url":"https://api.github.com/repos/ananthakumaran/typescript.el/milestones{/number}","notifications_url":"https://api.github.com/repos/ananthakumaran/typescript.el/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ananthakumaran/typescript.el/labels{/name}","releases_url":"https://api.github.com/repos/ananthakumaran/typescript.el/releases{/id}","deployments_url":"https://api.github.com/repos/ananthakumaran/typescript.el/deployments","created_at":"2015-06-07T11:39:14Z","updated_at":"2018-09-08T13:12:44Z","pushed_at":"2018-09-08T13:12:42Z","git_url":"git://github.com/ananthakumaran/typescript.el.git","ssh_url":"git@github.com:ananthakumaran/typescript.el.git","clone_url":"https://github.com/ananthakumaran/typescript.el.git","svn_url":"https://github.com/ananthakumaran/typescript.el","homepage":null,"size":189,"stargazers_count":63,"watchers_count":63,"language":"Emacs Lisp","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"archived":false,"open_issues_count":17,"license":null,"forks":39,"open_issues":17,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82"},"html":{"href":"https://github.com/ananthakumaran/typescript.el/pull/82"},"issue":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/issues/82"},"comments":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/ananthakumaran/typescript.el/statuses/0251f1c4279d973ff3a972417444d4fac64fed56"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lddubeau"}}