{"action":"created","comment":{"url":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/comments/81447786","pull_request_review_id":2429781,"id":81447786,"diff_hunk":"@@ -0,0 +1,148 @@\n+\" Returns a parsed stack of functions found in the text.  Each item in the\n+\" stack contains a dict:\n+\" - name: Function name.\n+\" - start: Argument start position.\n+\" - end: Argument end position.  -1 if the function is unclosed.\n+\" - pos: The argument position.  1-indexed, 0 = no args, -1 = closed.\n+\" - ppos: The function's position in the previous function in the stack.\n+\" - args: A list of argument positions.\n+function! echodoc#util#parse_funcs(text) abort\n+  if a:text == ''\n+    return []\n+  endif\n+\n+  let quote_i = -1\n+  let stack = []\n+  let open_stack = []\n+  let gap = 0\n+\n+  \" Matching pairs will count as a single argument entry so that commas can be\n+  \" skipped within them.  The open depth is tracked in each open stack item.\n+  \" Parenthesis is an exception since it's used for functions and can have a\n+  \" depth of 1.\n+  let pairs = '({[)}]'\n+  let l = len(a:text) - 1\n+  let i = -1\n+\n+  while i < l\n+    let i += 1\n+    let c = a:text[i]\n+\n+    if i > 0 && a:text[i - 1] == '\\'\n+      continue\n+    endif\n+\n+    if quote_i != -1\n+      \" For languages that allow '''' ?\n+      \" if c == \"'\" && a:text[i - 1] == c && i - quote_i > 1\n+      \"   continue\n+      \" endif\n+      if c == a:text[quote_i]\n+        let quote_i = -1\n+      endif\n+      continue\n+    endif\n+\n+    if quote_i == -1 && (c == \"'\" || c == '\"' || c == '`')\n+      \" backtick (`) is not used alone in languages that I know of.\n+      let quote_i = i\n+      continue\n+    endif\n+\n+    let prev = len(open_stack) ? open_stack[-1] : {'opens': [0, 0, 0]}\n+    execute 'let opened = '.join(prev.opens, '+')\n+\n+    let p = stridx(pairs, c)\n+    if p != -1\n+      let ci = p % 3\n+      if p == 3 && opened == 1 && prev.opens[0] == 1\n+        \" Closing the function parenthesis\n+        if len(open_stack)\n+          let item = remove(open_stack, -1)\n+          let item.end = i - 1\n+          let item.pos = -1\n+          let item.opens[0] -= 1\n+          if gap <= i\n+            call add(item.args, [gap, i - 1])\n+          endif\n+        endif\n+\n+        let gap = i + 1\n+      elseif p == 0\n+        \" Opening parenthesis\n+        let ppos = 0\n+        if len(open_stack)\n+          if gap != i\n+            call add(open_stack[-1].args, [gap, i])\n+            let open_stack[-1].pos += 1\n+          endif\n+          let ppos = open_stack[-1].pos\n+        endif\n+\n+        let name = a:text[gap:i - 1]\n+        if name != ''\n+          \" Opening parenthesis that's preceded by a non-empty string.\n+          call add(stack, {\n+                \\ 'name': name,\n+                \\ 'start': i + 1,\n+                \\ 'end': -1,\n+                \\ 'pos': 0,\n+                \\ 'ppos': ppos,\n+                \\ 'args': [],\n+                \\ 'opens': [1, 0, 0]\n+                \\ })\n+          call add(open_stack, stack[-1])\n+        endif\n+\n+        let gap = i + 1\n+      else\n+        let prev.opens[ci] += p > 2 ? -1 : 1\n+      endif\n+    elseif opened == 1 && prev.opens[0] == 1 && (c == ',' || c =~# '\\_s')\n+      \" Not nested in a pair.\n+      if len(open_stack) && gap != i\n+        let open_stack[-1].pos += 1\n+        call add(open_stack[-1].args, [gap, i - 1])\n+      endif\n+      let gap = i + 1\n+    elseif empty(stack) && c =~# '\\_s'\n+      let gap = i + 1\n+    endif\n+  endwhile\n+\n+  if len(open_stack)\n+    let item = open_stack[-1]\n+    call add(item.args, [gap, l])\n+    let item.pos += 1\n+  endif\n+\n+  return stack\n+endfunction\n+\n+\n+function! echodoc#util#completion_signature(completion) abort\n+  if empty(a:completion)\n+    return {}\n+  endif\n+\n+  let info = matchstr(a:completion.info, '^\\_s*\\zs.*')\n+\n+  if info == ''\n+    if a:completion.abbr =~# '^.\\+('\n+      let info = a:completion.abbr\n+    else\n+      if a:completion.word =~# '^.\\+(' || a:completion.kind == 'f'\n+        info = a:completion_word\n+      endif\n+    endif\n+  endif\n+\n+  let info = info[:100]","path":"autoload/echodoc/util.vim","position":140,"original_position":140,"commit_id":"98e7343074b9da7212d58d4a43581d1a3f6813f3","original_commit_id":"98e7343074b9da7212d58d4a43581d1a3f6813f3","user":{"login":"Shougo","id":41495,"avatar_url":"https://avatars.githubusercontent.com/u/41495?v=3","gravatar_id":"","url":"https://api.github.com/users/Shougo","html_url":"https://github.com/Shougo","followers_url":"https://api.github.com/users/Shougo/followers","following_url":"https://api.github.com/users/Shougo/following{/other_user}","gists_url":"https://api.github.com/users/Shougo/gists{/gist_id}","starred_url":"https://api.github.com/users/Shougo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shougo/subscriptions","organizations_url":"https://api.github.com/users/Shougo/orgs","repos_url":"https://api.github.com/users/Shougo/repos","events_url":"https://api.github.com/users/Shougo/events{/privacy}","received_events_url":"https://api.github.com/users/Shougo/received_events","type":"User","site_admin":false},"body":"`100` should be defined as CONSTANT variable.","created_at":"2016-10-01T10:18:39Z","updated_at":"2016-10-01T10:18:39Z","html_url":"https://github.com/Shougo/echodoc.vim/pull/13#discussion_r81447786","pull_request_url":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/comments/81447786"},"html":{"href":"https://github.com/Shougo/echodoc.vim/pull/13#discussion_r81447786"},"pull_request":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13","id":87560913,"html_url":"https://github.com/Shougo/echodoc.vim/pull/13","diff_url":"https://github.com/Shougo/echodoc.vim/pull/13.diff","patch_url":"https://github.com/Shougo/echodoc.vim/pull/13.patch","issue_url":"https://api.github.com/repos/Shougo/echodoc.vim/issues/13","number":13,"state":"open","locked":false,"title":"[WIP] Support nested function completions","user":{"login":"tweekmonster","id":111942,"avatar_url":"https://avatars.githubusercontent.com/u/111942?v=3","gravatar_id":"","url":"https://api.github.com/users/tweekmonster","html_url":"https://github.com/tweekmonster","followers_url":"https://api.github.com/users/tweekmonster/followers","following_url":"https://api.github.com/users/tweekmonster/following{/other_user}","gists_url":"https://api.github.com/users/tweekmonster/gists{/gist_id}","starred_url":"https://api.github.com/users/tweekmonster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tweekmonster/subscriptions","organizations_url":"https://api.github.com/users/tweekmonster/orgs","repos_url":"https://api.github.com/users/tweekmonster/repos","events_url":"https://api.github.com/users/tweekmonster/events{/privacy}","received_events_url":"https://api.github.com/users/tweekmonster/received_events","type":"User","site_admin":false},"body":"Hi Shougo!  Ever since I mentioned the issue with echodoc, it has been annoying me.\r\n\r\nI noticed you said want to work on this in the Neovim gitter channel.  I had already started to work on this a little and am creating this PR so you can see the progress and comment on it.","created_at":"2016-09-30T20:27:33Z","updated_at":"2016-10-01T10:18:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a902582e149e5b08614696817808d5b838cb0c50","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13/commits","review_comments_url":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13/comments","review_comment_url":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shougo/echodoc.vim/issues/13/comments","statuses_url":"https://api.github.com/repos/Shougo/echodoc.vim/statuses/98e7343074b9da7212d58d4a43581d1a3f6813f3","head":{"label":"tweekmonster:nested-completions","ref":"nested-completions","sha":"98e7343074b9da7212d58d4a43581d1a3f6813f3","user":{"login":"tweekmonster","id":111942,"avatar_url":"https://avatars.githubusercontent.com/u/111942?v=3","gravatar_id":"","url":"https://api.github.com/users/tweekmonster","html_url":"https://github.com/tweekmonster","followers_url":"https://api.github.com/users/tweekmonster/followers","following_url":"https://api.github.com/users/tweekmonster/following{/other_user}","gists_url":"https://api.github.com/users/tweekmonster/gists{/gist_id}","starred_url":"https://api.github.com/users/tweekmonster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tweekmonster/subscriptions","organizations_url":"https://api.github.com/users/tweekmonster/orgs","repos_url":"https://api.github.com/users/tweekmonster/repos","events_url":"https://api.github.com/users/tweekmonster/events{/privacy}","received_events_url":"https://api.github.com/users/tweekmonster/received_events","type":"User","site_admin":false},"repo":{"id":69679420,"name":"echodoc.vim","full_name":"tweekmonster/echodoc.vim","owner":{"login":"tweekmonster","id":111942,"avatar_url":"https://avatars.githubusercontent.com/u/111942?v=3","gravatar_id":"","url":"https://api.github.com/users/tweekmonster","html_url":"https://github.com/tweekmonster","followers_url":"https://api.github.com/users/tweekmonster/followers","following_url":"https://api.github.com/users/tweekmonster/following{/other_user}","gists_url":"https://api.github.com/users/tweekmonster/gists{/gist_id}","starred_url":"https://api.github.com/users/tweekmonster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tweekmonster/subscriptions","organizations_url":"https://api.github.com/users/tweekmonster/orgs","repos_url":"https://api.github.com/users/tweekmonster/repos","events_url":"https://api.github.com/users/tweekmonster/events{/privacy}","received_events_url":"https://api.github.com/users/tweekmonster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tweekmonster/echodoc.vim","description":"Print documents in echo area.","fork":true,"url":"https://api.github.com/repos/tweekmonster/echodoc.vim","forks_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/forks","keys_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/teams","hooks_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/hooks","issue_events_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/issues/events{/number}","events_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/events","assignees_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/assignees{/user}","branches_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/branches{/branch}","tags_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/tags","blobs_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/git/refs{/sha}","trees_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/statuses/{sha}","languages_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/languages","stargazers_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/stargazers","contributors_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/contributors","subscribers_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/subscribers","subscription_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/subscription","commits_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/commits{/sha}","git_commits_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/git/commits{/sha}","comments_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/comments{/number}","issue_comment_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/issues/comments{/number}","contents_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/contents/{+path}","compare_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/merges","archive_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/downloads","issues_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/issues{/number}","pulls_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/pulls{/number}","milestones_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/milestones{/number}","notifications_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/labels{/name}","releases_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/releases{/id}","deployments_url":"https://api.github.com/repos/tweekmonster/echodoc.vim/deployments","created_at":"2016-09-30T15:40:34Z","updated_at":"2016-09-30T15:40:35Z","pushed_at":"2016-10-01T05:33:07Z","git_url":"git://github.com/tweekmonster/echodoc.vim.git","ssh_url":"git@github.com:tweekmonster/echodoc.vim.git","clone_url":"https://github.com/tweekmonster/echodoc.vim.git","svn_url":"https://github.com/tweekmonster/echodoc.vim","homepage":"","size":38,"stargazers_count":0,"watchers_count":0,"language":"VimL","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Shougo:master","ref":"master","sha":"6ad07093eb31e796409f42a124b344aae09b10f2","user":{"login":"Shougo","id":41495,"avatar_url":"https://avatars.githubusercontent.com/u/41495?v=3","gravatar_id":"","url":"https://api.github.com/users/Shougo","html_url":"https://github.com/Shougo","followers_url":"https://api.github.com/users/Shougo/followers","following_url":"https://api.github.com/users/Shougo/following{/other_user}","gists_url":"https://api.github.com/users/Shougo/gists{/gist_id}","starred_url":"https://api.github.com/users/Shougo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shougo/subscriptions","organizations_url":"https://api.github.com/users/Shougo/orgs","repos_url":"https://api.github.com/users/Shougo/repos","events_url":"https://api.github.com/users/Shougo/events{/privacy}","received_events_url":"https://api.github.com/users/Shougo/received_events","type":"User","site_admin":false},"repo":{"id":698980,"name":"echodoc.vim","full_name":"Shougo/echodoc.vim","owner":{"login":"Shougo","id":41495,"avatar_url":"https://avatars.githubusercontent.com/u/41495?v=3","gravatar_id":"","url":"https://api.github.com/users/Shougo","html_url":"https://github.com/Shougo","followers_url":"https://api.github.com/users/Shougo/followers","following_url":"https://api.github.com/users/Shougo/following{/other_user}","gists_url":"https://api.github.com/users/Shougo/gists{/gist_id}","starred_url":"https://api.github.com/users/Shougo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shougo/subscriptions","organizations_url":"https://api.github.com/users/Shougo/orgs","repos_url":"https://api.github.com/users/Shougo/repos","events_url":"https://api.github.com/users/Shougo/events{/privacy}","received_events_url":"https://api.github.com/users/Shougo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Shougo/echodoc.vim","description":"Print documents in echo area.","fork":false,"url":"https://api.github.com/repos/Shougo/echodoc.vim","forks_url":"https://api.github.com/repos/Shougo/echodoc.vim/forks","keys_url":"https://api.github.com/repos/Shougo/echodoc.vim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shougo/echodoc.vim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shougo/echodoc.vim/teams","hooks_url":"https://api.github.com/repos/Shougo/echodoc.vim/hooks","issue_events_url":"https://api.github.com/repos/Shougo/echodoc.vim/issues/events{/number}","events_url":"https://api.github.com/repos/Shougo/echodoc.vim/events","assignees_url":"https://api.github.com/repos/Shougo/echodoc.vim/assignees{/user}","branches_url":"https://api.github.com/repos/Shougo/echodoc.vim/branches{/branch}","tags_url":"https://api.github.com/repos/Shougo/echodoc.vim/tags","blobs_url":"https://api.github.com/repos/Shougo/echodoc.vim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shougo/echodoc.vim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shougo/echodoc.vim/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shougo/echodoc.vim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shougo/echodoc.vim/statuses/{sha}","languages_url":"https://api.github.com/repos/Shougo/echodoc.vim/languages","stargazers_url":"https://api.github.com/repos/Shougo/echodoc.vim/stargazers","contributors_url":"https://api.github.com/repos/Shougo/echodoc.vim/contributors","subscribers_url":"https://api.github.com/repos/Shougo/echodoc.vim/subscribers","subscription_url":"https://api.github.com/repos/Shougo/echodoc.vim/subscription","commits_url":"https://api.github.com/repos/Shougo/echodoc.vim/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shougo/echodoc.vim/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shougo/echodoc.vim/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shougo/echodoc.vim/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shougo/echodoc.vim/contents/{+path}","compare_url":"https://api.github.com/repos/Shougo/echodoc.vim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shougo/echodoc.vim/merges","archive_url":"https://api.github.com/repos/Shougo/echodoc.vim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shougo/echodoc.vim/downloads","issues_url":"https://api.github.com/repos/Shougo/echodoc.vim/issues{/number}","pulls_url":"https://api.github.com/repos/Shougo/echodoc.vim/pulls{/number}","milestones_url":"https://api.github.com/repos/Shougo/echodoc.vim/milestones{/number}","notifications_url":"https://api.github.com/repos/Shougo/echodoc.vim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shougo/echodoc.vim/labels{/name}","releases_url":"https://api.github.com/repos/Shougo/echodoc.vim/releases{/id}","deployments_url":"https://api.github.com/repos/Shougo/echodoc.vim/deployments","created_at":"2010-06-02T10:39:47Z","updated_at":"2016-09-29T21:01:01Z","pushed_at":"2016-10-01T05:33:08Z","git_url":"git://github.com/Shougo/echodoc.vim.git","ssh_url":"git@github.com:Shougo/echodoc.vim.git","clone_url":"https://github.com/Shougo/echodoc.vim.git","svn_url":"https://github.com/Shougo/echodoc.vim","homepage":"","size":50,"stargazers_count":30,"watchers_count":30,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13"},"html":{"href":"https://github.com/Shougo/echodoc.vim/pull/13"},"issue":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/issues/13"},"comments":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/Shougo/echodoc.vim/statuses/98e7343074b9da7212d58d4a43581d1a3f6813f3"}}}}
{"actor":{"display_login":"Shougo"}}