{"action":"created","comment":{"url":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/comments/88846754","pull_request_review_id":9406021,"id":88846754,"diff_hunk":"@@ -0,0 +1,75 @@\n+import re\n+\n+from deoplete.source.base import Base\n+\n+try:\n+    from beancount.loader import load_file\n+    from beancount.core.data import Open, Transaction\n+    HAS_BEANCOUNT = True\n+except ImportError:\n+    HAS_BEANCOUNT = False\n+\n+DIRECTIVES = ['open', 'close', 'commodity', 'txn', 'balance', 'pad', 'note',\n+              'document', 'price', 'event', 'query', 'custom']\n+\n+\n+class Source(Base):\n+    def __init__(self, vim):\n+        super().__init__(vim)\n+        self.vim = vim\n+\n+        self.name = 'beancount'\n+        self.mark = '[bc]'\n+        self.filetypes = ['beancount']\n+        self.min_pattern_length = 0\n+\n+    def on_init(self, context):\n+        if not HAS_BEANCOUNT:\n+            self.error('Importing beancount failed.')\n+\n+    def on_event(self, context):\n+        self.__make_cache(context)\n+\n+    def get_complete_position(self, context):\n+        m = re.search(r'\\S*$', context['input'])\n+        return m.start() if m else -1\n+\n+    def gather_candidates(self, context):\n+        if re.match(r'^\\d{4}[/-]\\d\\d[/-]\\d\\d \\w*$', context['input']):\n+            return DIRECTIVES\n+        if not context['complete_str']:\n+            return []\n+        first = context['complete_str'][0]\n+        if first == '#':\n+            return ['#' + w for w in self._tags]\n+        elif first == '^':\n+            return ['^' + w for w in self._links]\n+        elif first == '\"':\n+            return ['\"{}\"'.format(w) for w in self._payees]\n+        return self._accounts","path":"rplugin/python3/deoplete/sources/beancount.py","position":49,"original_position":49,"commit_id":"3a9665dd45ad38bc98f18a091fe460f7a46ea4df","original_commit_id":"3a9665dd45ad38bc98f18a091fe460f7a46ea4df","user":{"login":"yagebu","id":2482259,"avatar_url":"https://avatars.githubusercontent.com/u/2482259?v=3","gravatar_id":"","url":"https://api.github.com/users/yagebu","html_url":"https://github.com/yagebu","followers_url":"https://api.github.com/users/yagebu/followers","following_url":"https://api.github.com/users/yagebu/following{/other_user}","gists_url":"https://api.github.com/users/yagebu/gists{/gist_id}","starred_url":"https://api.github.com/users/yagebu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yagebu/subscriptions","organizations_url":"https://api.github.com/users/yagebu/orgs","repos_url":"https://api.github.com/users/yagebu/repos","events_url":"https://api.github.com/users/yagebu/events{/privacy}","received_events_url":"https://api.github.com/users/yagebu/received_events","type":"User","site_admin":false},"body":"That's what it does ;)","created_at":"2016-11-21T08:26:54Z","updated_at":"2016-11-21T08:26:54Z","html_url":"https://github.com/nathangrigg/vim-beancount/pull/31#discussion_r88846754","pull_request_url":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/comments/88846754"},"html":{"href":"https://github.com/nathangrigg/vim-beancount/pull/31#discussion_r88846754"},"pull_request":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31","id":94528583,"html_url":"https://github.com/nathangrigg/vim-beancount/pull/31","diff_url":"https://github.com/nathangrigg/vim-beancount/pull/31.diff","patch_url":"https://github.com/nathangrigg/vim-beancount/pull/31.patch","issue_url":"https://api.github.com/repos/nathangrigg/vim-beancount/issues/31","number":31,"state":"open","locked":false,"title":"add deoplete source","user":{"login":"yagebu","id":2482259,"avatar_url":"https://avatars.githubusercontent.com/u/2482259?v=3","gravatar_id":"","url":"https://api.github.com/users/yagebu","html_url":"https://github.com/yagebu","followers_url":"https://api.github.com/users/yagebu/followers","following_url":"https://api.github.com/users/yagebu/following{/other_user}","gists_url":"https://api.github.com/users/yagebu/gists{/gist_id}","starred_url":"https://api.github.com/users/yagebu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yagebu/subscriptions","organizations_url":"https://api.github.com/users/yagebu/orgs","repos_url":"https://api.github.com/users/yagebu/repos","events_url":"https://api.github.com/users/yagebu/events{/privacy}","received_events_url":"https://api.github.com/users/yagebu/received_events","type":"User","site_admin":false},"body":"This allows for truly asynchronous completion in Neovim. Feature-wise still should be as good as the current omnicompletion (except for event types).\r\n\r\nRef #29","created_at":"2016-11-20T19:14:20Z","updated_at":"2016-11-21T08:26:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d133d7b4619d39ffb73f82f4bffe9fd5d956726","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31/commits","review_comments_url":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31/comments","review_comment_url":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nathangrigg/vim-beancount/issues/31/comments","statuses_url":"https://api.github.com/repos/nathangrigg/vim-beancount/statuses/3a9665dd45ad38bc98f18a091fe460f7a46ea4df","head":{"label":"yagebu:master","ref":"master","sha":"3a9665dd45ad38bc98f18a091fe460f7a46ea4df","user":{"login":"yagebu","id":2482259,"avatar_url":"https://avatars.githubusercontent.com/u/2482259?v=3","gravatar_id":"","url":"https://api.github.com/users/yagebu","html_url":"https://github.com/yagebu","followers_url":"https://api.github.com/users/yagebu/followers","following_url":"https://api.github.com/users/yagebu/following{/other_user}","gists_url":"https://api.github.com/users/yagebu/gists{/gist_id}","starred_url":"https://api.github.com/users/yagebu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yagebu/subscriptions","organizations_url":"https://api.github.com/users/yagebu/orgs","repos_url":"https://api.github.com/users/yagebu/repos","events_url":"https://api.github.com/users/yagebu/events{/privacy}","received_events_url":"https://api.github.com/users/yagebu/received_events","type":"User","site_admin":false},"repo":{"id":73496111,"name":"vim-beancount","full_name":"yagebu/vim-beancount","owner":{"login":"yagebu","id":2482259,"avatar_url":"https://avatars.githubusercontent.com/u/2482259?v=3","gravatar_id":"","url":"https://api.github.com/users/yagebu","html_url":"https://github.com/yagebu","followers_url":"https://api.github.com/users/yagebu/followers","following_url":"https://api.github.com/users/yagebu/following{/other_user}","gists_url":"https://api.github.com/users/yagebu/gists{/gist_id}","starred_url":"https://api.github.com/users/yagebu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yagebu/subscriptions","organizations_url":"https://api.github.com/users/yagebu/orgs","repos_url":"https://api.github.com/users/yagebu/repos","events_url":"https://api.github.com/users/yagebu/events{/privacy}","received_events_url":"https://api.github.com/users/yagebu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yagebu/vim-beancount","description":"Vim ftplugin for beancount","fork":true,"url":"https://api.github.com/repos/yagebu/vim-beancount","forks_url":"https://api.github.com/repos/yagebu/vim-beancount/forks","keys_url":"https://api.github.com/repos/yagebu/vim-beancount/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yagebu/vim-beancount/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yagebu/vim-beancount/teams","hooks_url":"https://api.github.com/repos/yagebu/vim-beancount/hooks","issue_events_url":"https://api.github.com/repos/yagebu/vim-beancount/issues/events{/number}","events_url":"https://api.github.com/repos/yagebu/vim-beancount/events","assignees_url":"https://api.github.com/repos/yagebu/vim-beancount/assignees{/user}","branches_url":"https://api.github.com/repos/yagebu/vim-beancount/branches{/branch}","tags_url":"https://api.github.com/repos/yagebu/vim-beancount/tags","blobs_url":"https://api.github.com/repos/yagebu/vim-beancount/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yagebu/vim-beancount/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yagebu/vim-beancount/git/refs{/sha}","trees_url":"https://api.github.com/repos/yagebu/vim-beancount/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yagebu/vim-beancount/statuses/{sha}","languages_url":"https://api.github.com/repos/yagebu/vim-beancount/languages","stargazers_url":"https://api.github.com/repos/yagebu/vim-beancount/stargazers","contributors_url":"https://api.github.com/repos/yagebu/vim-beancount/contributors","subscribers_url":"https://api.github.com/repos/yagebu/vim-beancount/subscribers","subscription_url":"https://api.github.com/repos/yagebu/vim-beancount/subscription","commits_url":"https://api.github.com/repos/yagebu/vim-beancount/commits{/sha}","git_commits_url":"https://api.github.com/repos/yagebu/vim-beancount/git/commits{/sha}","comments_url":"https://api.github.com/repos/yagebu/vim-beancount/comments{/number}","issue_comment_url":"https://api.github.com/repos/yagebu/vim-beancount/issues/comments{/number}","contents_url":"https://api.github.com/repos/yagebu/vim-beancount/contents/{+path}","compare_url":"https://api.github.com/repos/yagebu/vim-beancount/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yagebu/vim-beancount/merges","archive_url":"https://api.github.com/repos/yagebu/vim-beancount/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yagebu/vim-beancount/downloads","issues_url":"https://api.github.com/repos/yagebu/vim-beancount/issues{/number}","pulls_url":"https://api.github.com/repos/yagebu/vim-beancount/pulls{/number}","milestones_url":"https://api.github.com/repos/yagebu/vim-beancount/milestones{/number}","notifications_url":"https://api.github.com/repos/yagebu/vim-beancount/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yagebu/vim-beancount/labels{/name}","releases_url":"https://api.github.com/repos/yagebu/vim-beancount/releases{/id}","deployments_url":"https://api.github.com/repos/yagebu/vim-beancount/deployments","created_at":"2016-11-11T17:07:20Z","updated_at":"2016-11-11T17:07:22Z","pushed_at":"2016-11-20T19:10:01Z","git_url":"git://github.com/yagebu/vim-beancount.git","ssh_url":"git@github.com:yagebu/vim-beancount.git","clone_url":"https://github.com/yagebu/vim-beancount.git","svn_url":"https://github.com/yagebu/vim-beancount","homepage":null,"size":43,"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":"nathangrigg:master","ref":"master","sha":"391df18ca139a611864bfea11e203976f16494fc","user":{"login":"nathangrigg","id":896960,"avatar_url":"https://avatars.githubusercontent.com/u/896960?v=3","gravatar_id":"","url":"https://api.github.com/users/nathangrigg","html_url":"https://github.com/nathangrigg","followers_url":"https://api.github.com/users/nathangrigg/followers","following_url":"https://api.github.com/users/nathangrigg/following{/other_user}","gists_url":"https://api.github.com/users/nathangrigg/gists{/gist_id}","starred_url":"https://api.github.com/users/nathangrigg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathangrigg/subscriptions","organizations_url":"https://api.github.com/users/nathangrigg/orgs","repos_url":"https://api.github.com/users/nathangrigg/repos","events_url":"https://api.github.com/users/nathangrigg/events{/privacy}","received_events_url":"https://api.github.com/users/nathangrigg/received_events","type":"User","site_admin":false},"repo":{"id":24867673,"name":"vim-beancount","full_name":"nathangrigg/vim-beancount","owner":{"login":"nathangrigg","id":896960,"avatar_url":"https://avatars.githubusercontent.com/u/896960?v=3","gravatar_id":"","url":"https://api.github.com/users/nathangrigg","html_url":"https://github.com/nathangrigg","followers_url":"https://api.github.com/users/nathangrigg/followers","following_url":"https://api.github.com/users/nathangrigg/following{/other_user}","gists_url":"https://api.github.com/users/nathangrigg/gists{/gist_id}","starred_url":"https://api.github.com/users/nathangrigg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathangrigg/subscriptions","organizations_url":"https://api.github.com/users/nathangrigg/orgs","repos_url":"https://api.github.com/users/nathangrigg/repos","events_url":"https://api.github.com/users/nathangrigg/events{/privacy}","received_events_url":"https://api.github.com/users/nathangrigg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nathangrigg/vim-beancount","description":"Vim ftplugin for beancount","fork":false,"url":"https://api.github.com/repos/nathangrigg/vim-beancount","forks_url":"https://api.github.com/repos/nathangrigg/vim-beancount/forks","keys_url":"https://api.github.com/repos/nathangrigg/vim-beancount/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nathangrigg/vim-beancount/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nathangrigg/vim-beancount/teams","hooks_url":"https://api.github.com/repos/nathangrigg/vim-beancount/hooks","issue_events_url":"https://api.github.com/repos/nathangrigg/vim-beancount/issues/events{/number}","events_url":"https://api.github.com/repos/nathangrigg/vim-beancount/events","assignees_url":"https://api.github.com/repos/nathangrigg/vim-beancount/assignees{/user}","branches_url":"https://api.github.com/repos/nathangrigg/vim-beancount/branches{/branch}","tags_url":"https://api.github.com/repos/nathangrigg/vim-beancount/tags","blobs_url":"https://api.github.com/repos/nathangrigg/vim-beancount/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nathangrigg/vim-beancount/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nathangrigg/vim-beancount/git/refs{/sha}","trees_url":"https://api.github.com/repos/nathangrigg/vim-beancount/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nathangrigg/vim-beancount/statuses/{sha}","languages_url":"https://api.github.com/repos/nathangrigg/vim-beancount/languages","stargazers_url":"https://api.github.com/repos/nathangrigg/vim-beancount/stargazers","contributors_url":"https://api.github.com/repos/nathangrigg/vim-beancount/contributors","subscribers_url":"https://api.github.com/repos/nathangrigg/vim-beancount/subscribers","subscription_url":"https://api.github.com/repos/nathangrigg/vim-beancount/subscription","commits_url":"https://api.github.com/repos/nathangrigg/vim-beancount/commits{/sha}","git_commits_url":"https://api.github.com/repos/nathangrigg/vim-beancount/git/commits{/sha}","comments_url":"https://api.github.com/repos/nathangrigg/vim-beancount/comments{/number}","issue_comment_url":"https://api.github.com/repos/nathangrigg/vim-beancount/issues/comments{/number}","contents_url":"https://api.github.com/repos/nathangrigg/vim-beancount/contents/{+path}","compare_url":"https://api.github.com/repos/nathangrigg/vim-beancount/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nathangrigg/vim-beancount/merges","archive_url":"https://api.github.com/repos/nathangrigg/vim-beancount/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nathangrigg/vim-beancount/downloads","issues_url":"https://api.github.com/repos/nathangrigg/vim-beancount/issues{/number}","pulls_url":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls{/number}","milestones_url":"https://api.github.com/repos/nathangrigg/vim-beancount/milestones{/number}","notifications_url":"https://api.github.com/repos/nathangrigg/vim-beancount/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nathangrigg/vim-beancount/labels{/name}","releases_url":"https://api.github.com/repos/nathangrigg/vim-beancount/releases{/id}","deployments_url":"https://api.github.com/repos/nathangrigg/vim-beancount/deployments","created_at":"2014-10-06T22:36:13Z","updated_at":"2016-11-12T00:29:45Z","pushed_at":"2016-11-20T19:14:20Z","git_url":"git://github.com/nathangrigg/vim-beancount.git","ssh_url":"git@github.com:nathangrigg/vim-beancount.git","clone_url":"https://github.com/nathangrigg/vim-beancount.git","svn_url":"https://github.com/nathangrigg/vim-beancount","homepage":null,"size":54,"stargazers_count":13,"watchers_count":13,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":4,"forks":9,"open_issues":4,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31"},"html":{"href":"https://github.com/nathangrigg/vim-beancount/pull/31"},"issue":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/issues/31"},"comments":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/nathangrigg/vim-beancount/statuses/3a9665dd45ad38bc98f18a091fe460f7a46ea4df"}}}}
{"actor":{"display_login":"yagebu"}}