{"action":"created","comment":{"url":"https://api.github.com/repos/bardsoftware/ace/pulls/comments/113437082","pull_request_review_id":34823623,"id":113437082,"diff_hunk":"@@ -39,76 +37,71 @@ define((require, exports, module) ->\n       @openPopup(@editor, prefix, keepPopupPosition)\n \n     insertMatch: (editor, data) =>\n-      if not data?\n-        data = @popup.getData(@popup.getRow())\n-      if not data?\n+      data ?= @popup.getData(@popup.getRow())\n+      if not data? or not data.action?\n         @detach()\n         return\n-\n-      if data.name == \"Create new file\"\n-        @_doCreate()\n-      else\n-        @_doInsert(data.file)\n+      data.action()\n \n     detach: =>\n       @editor.completer = new Autocomplete.Autocomplete()\n       super()\n \n \n   class BiblioCompleter\n-    constructor: () ->\n-      @enabledMendeley = false\n-\n-    setEnabledMendeley: (enabledMendeley) => @enabledMendeley = enabledMendeley\n+    constructor: (@enabledMendeley, @searchLabel, @importLabel, @importSource, @searchCallback) ->\n+      @isDisposable = true\n \n     getCompletions: (editor, session, pos, prefix, callback) =>\n       token = session.getTokenAt(pos.row, pos.column)\n \n       if LatexParsingContext.isType(token, \"cite\")\n-        default_result = [{\n-          name: \"Search\"\n-          snippet: \"Search \" + prefix\n+        defaultResult = [{\n+          name: @searchLabel\n+          snippet: @searchLabel + prefix\n           meta: \"\"\n           score: 1000\n           meta_score: 10\n           completer: this\n+          action: (editor) => @_doSearch(editor)\n         }]\n         # We don't show Import option to free users\n-        if @enabledMendeley\n-          default_result.push({\n-            name: \"Import\"\n-            snippet: \"Import \" + prefix\n-            meta: \"from Mendeley\"\n+        if @enabledMendeley?\n+          defaultResult.push({\n+            name: @importLabel\n+            snippet: @importLabel + prefix\n+            meta: @importSource\n             score: 1000","path":"lib/ace/ext/papeeria/biblio_completer.coffee","position":null,"original_position":98,"commit_id":"c10dc7e24d631be3fb344199e8871acd5124ddf6","original_commit_id":"c10dc7e24d631be3fb344199e8871acd5124ddf6","user":{"login":"khazhoyan","id":8560130,"avatar_url":"https://avatars1.githubusercontent.com/u/8560130?v=3","gravatar_id":"","url":"https://api.github.com/users/khazhoyan","html_url":"https://github.com/khazhoyan","followers_url":"https://api.github.com/users/khazhoyan/followers","following_url":"https://api.github.com/users/khazhoyan/following{/other_user}","gists_url":"https://api.github.com/users/khazhoyan/gists{/gist_id}","starred_url":"https://api.github.com/users/khazhoyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khazhoyan/subscriptions","organizations_url":"https://api.github.com/users/khazhoyan/orgs","repos_url":"https://api.github.com/users/khazhoyan/repos","events_url":"https://api.github.com/users/khazhoyan/events{/privacy}","received_events_url":"https://api.github.com/users/khazhoyan/received_events","type":"User","site_admin":false},"body":"you sure a thousand is enough? I used `Number.MAX_VALUE`. \r\nand please extract it to a constant :)\r\nalso make sure it's okay that both import and search objects have the same `score`","created_at":"2017-04-26T12:24:49Z","updated_at":"2017-04-26T12:47:33Z","html_url":"https://github.com/bardsoftware/ace/pull/120#discussion_r113437082","pull_request_url":"https://api.github.com/repos/bardsoftware/ace/pulls/120","_links":{"self":{"href":"https://api.github.com/repos/bardsoftware/ace/pulls/comments/113437082"},"html":{"href":"https://github.com/bardsoftware/ace/pull/120#discussion_r113437082"},"pull_request":{"href":"https://api.github.com/repos/bardsoftware/ace/pulls/120"}}},"pull_request":{"url":"https://api.github.com/repos/bardsoftware/ace/pulls/120","id":115958082,"html_url":"https://github.com/bardsoftware/ace/pull/120","diff_url":"https://github.com/bardsoftware/ace/pull/120.diff","patch_url":"https://github.com/bardsoftware/ace/pull/120.patch","issue_url":"https://api.github.com/repos/bardsoftware/ace/issues/120","number":120,"state":"open","locked":false,"title":"Biblio search completer","user":{"login":"alinadubatovka","id":6866408,"avatar_url":"https://avatars0.githubusercontent.com/u/6866408?v=3","gravatar_id":"","url":"https://api.github.com/users/alinadubatovka","html_url":"https://github.com/alinadubatovka","followers_url":"https://api.github.com/users/alinadubatovka/followers","following_url":"https://api.github.com/users/alinadubatovka/following{/other_user}","gists_url":"https://api.github.com/users/alinadubatovka/gists{/gist_id}","starred_url":"https://api.github.com/users/alinadubatovka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alinadubatovka/subscriptions","organizations_url":"https://api.github.com/users/alinadubatovka/orgs","repos_url":"https://api.github.com/users/alinadubatovka/repos","events_url":"https://api.github.com/users/alinadubatovka/events{/privacy}","received_events_url":"https://api.github.com/users/alinadubatovka/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-04-14T16:59:28Z","updated_at":"2017-04-26T12:47:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"850b64895e4c52736d645d1520dd4c8929c3c4af","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bardsoftware/ace/pulls/120/commits","review_comments_url":"https://api.github.com/repos/bardsoftware/ace/pulls/120/comments","review_comment_url":"https://api.github.com/repos/bardsoftware/ace/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bardsoftware/ace/issues/120/comments","statuses_url":"https://api.github.com/repos/bardsoftware/ace/statuses/c10dc7e24d631be3fb344199e8871acd5124ddf6","head":{"label":"bardsoftware:biblio_autocompletion","ref":"biblio_autocompletion","sha":"c10dc7e24d631be3fb344199e8871acd5124ddf6","user":{"login":"bardsoftware","id":2625618,"avatar_url":"https://avatars2.githubusercontent.com/u/2625618?v=3","gravatar_id":"","url":"https://api.github.com/users/bardsoftware","html_url":"https://github.com/bardsoftware","followers_url":"https://api.github.com/users/bardsoftware/followers","following_url":"https://api.github.com/users/bardsoftware/following{/other_user}","gists_url":"https://api.github.com/users/bardsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/bardsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardsoftware/subscriptions","organizations_url":"https://api.github.com/users/bardsoftware/orgs","repos_url":"https://api.github.com/users/bardsoftware/repos","events_url":"https://api.github.com/users/bardsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/bardsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":13590146,"name":"ace","full_name":"bardsoftware/ace","owner":{"login":"bardsoftware","id":2625618,"avatar_url":"https://avatars2.githubusercontent.com/u/2625618?v=3","gravatar_id":"","url":"https://api.github.com/users/bardsoftware","html_url":"https://github.com/bardsoftware","followers_url":"https://api.github.com/users/bardsoftware/followers","following_url":"https://api.github.com/users/bardsoftware/following{/other_user}","gists_url":"https://api.github.com/users/bardsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/bardsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardsoftware/subscriptions","organizations_url":"https://api.github.com/users/bardsoftware/orgs","repos_url":"https://api.github.com/users/bardsoftware/repos","events_url":"https://api.github.com/users/bardsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/bardsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bardsoftware/ace","description":"Ace (Ajax.org Cloud9 Editor)","fork":true,"url":"https://api.github.com/repos/bardsoftware/ace","forks_url":"https://api.github.com/repos/bardsoftware/ace/forks","keys_url":"https://api.github.com/repos/bardsoftware/ace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bardsoftware/ace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bardsoftware/ace/teams","hooks_url":"https://api.github.com/repos/bardsoftware/ace/hooks","issue_events_url":"https://api.github.com/repos/bardsoftware/ace/issues/events{/number}","events_url":"https://api.github.com/repos/bardsoftware/ace/events","assignees_url":"https://api.github.com/repos/bardsoftware/ace/assignees{/user}","branches_url":"https://api.github.com/repos/bardsoftware/ace/branches{/branch}","tags_url":"https://api.github.com/repos/bardsoftware/ace/tags","blobs_url":"https://api.github.com/repos/bardsoftware/ace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bardsoftware/ace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bardsoftware/ace/git/refs{/sha}","trees_url":"https://api.github.com/repos/bardsoftware/ace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bardsoftware/ace/statuses/{sha}","languages_url":"https://api.github.com/repos/bardsoftware/ace/languages","stargazers_url":"https://api.github.com/repos/bardsoftware/ace/stargazers","contributors_url":"https://api.github.com/repos/bardsoftware/ace/contributors","subscribers_url":"https://api.github.com/repos/bardsoftware/ace/subscribers","subscription_url":"https://api.github.com/repos/bardsoftware/ace/subscription","commits_url":"https://api.github.com/repos/bardsoftware/ace/commits{/sha}","git_commits_url":"https://api.github.com/repos/bardsoftware/ace/git/commits{/sha}","comments_url":"https://api.github.com/repos/bardsoftware/ace/comments{/number}","issue_comment_url":"https://api.github.com/repos/bardsoftware/ace/issues/comments{/number}","contents_url":"https://api.github.com/repos/bardsoftware/ace/contents/{+path}","compare_url":"https://api.github.com/repos/bardsoftware/ace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bardsoftware/ace/merges","archive_url":"https://api.github.com/repos/bardsoftware/ace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bardsoftware/ace/downloads","issues_url":"https://api.github.com/repos/bardsoftware/ace/issues{/number}","pulls_url":"https://api.github.com/repos/bardsoftware/ace/pulls{/number}","milestones_url":"https://api.github.com/repos/bardsoftware/ace/milestones{/number}","notifications_url":"https://api.github.com/repos/bardsoftware/ace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bardsoftware/ace/labels{/name}","releases_url":"https://api.github.com/repos/bardsoftware/ace/releases{/id}","deployments_url":"https://api.github.com/repos/bardsoftware/ace/deployments","created_at":"2013-10-15T13:03:16Z","updated_at":"2016-10-26T16:51:24Z","pushed_at":"2017-04-25T18:35:48Z","git_url":"git://github.com/bardsoftware/ace.git","ssh_url":"git@github.com:bardsoftware/ace.git","clone_url":"https://github.com/bardsoftware/ace.git","svn_url":"https://github.com/bardsoftware/ace","homepage":"http://ace.c9.io","size":37775,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":5,"default_branch":"internship-2016"}},"base":{"label":"bardsoftware:papeeria_master","ref":"papeeria_master","sha":"9e46e4332bcb039c83a089c8bd5d3ccc746c66fa","user":{"login":"bardsoftware","id":2625618,"avatar_url":"https://avatars2.githubusercontent.com/u/2625618?v=3","gravatar_id":"","url":"https://api.github.com/users/bardsoftware","html_url":"https://github.com/bardsoftware","followers_url":"https://api.github.com/users/bardsoftware/followers","following_url":"https://api.github.com/users/bardsoftware/following{/other_user}","gists_url":"https://api.github.com/users/bardsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/bardsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardsoftware/subscriptions","organizations_url":"https://api.github.com/users/bardsoftware/orgs","repos_url":"https://api.github.com/users/bardsoftware/repos","events_url":"https://api.github.com/users/bardsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/bardsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":13590146,"name":"ace","full_name":"bardsoftware/ace","owner":{"login":"bardsoftware","id":2625618,"avatar_url":"https://avatars2.githubusercontent.com/u/2625618?v=3","gravatar_id":"","url":"https://api.github.com/users/bardsoftware","html_url":"https://github.com/bardsoftware","followers_url":"https://api.github.com/users/bardsoftware/followers","following_url":"https://api.github.com/users/bardsoftware/following{/other_user}","gists_url":"https://api.github.com/users/bardsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/bardsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardsoftware/subscriptions","organizations_url":"https://api.github.com/users/bardsoftware/orgs","repos_url":"https://api.github.com/users/bardsoftware/repos","events_url":"https://api.github.com/users/bardsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/bardsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bardsoftware/ace","description":"Ace (Ajax.org Cloud9 Editor)","fork":true,"url":"https://api.github.com/repos/bardsoftware/ace","forks_url":"https://api.github.com/repos/bardsoftware/ace/forks","keys_url":"https://api.github.com/repos/bardsoftware/ace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bardsoftware/ace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bardsoftware/ace/teams","hooks_url":"https://api.github.com/repos/bardsoftware/ace/hooks","issue_events_url":"https://api.github.com/repos/bardsoftware/ace/issues/events{/number}","events_url":"https://api.github.com/repos/bardsoftware/ace/events","assignees_url":"https://api.github.com/repos/bardsoftware/ace/assignees{/user}","branches_url":"https://api.github.com/repos/bardsoftware/ace/branches{/branch}","tags_url":"https://api.github.com/repos/bardsoftware/ace/tags","blobs_url":"https://api.github.com/repos/bardsoftware/ace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bardsoftware/ace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bardsoftware/ace/git/refs{/sha}","trees_url":"https://api.github.com/repos/bardsoftware/ace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bardsoftware/ace/statuses/{sha}","languages_url":"https://api.github.com/repos/bardsoftware/ace/languages","stargazers_url":"https://api.github.com/repos/bardsoftware/ace/stargazers","contributors_url":"https://api.github.com/repos/bardsoftware/ace/contributors","subscribers_url":"https://api.github.com/repos/bardsoftware/ace/subscribers","subscription_url":"https://api.github.com/repos/bardsoftware/ace/subscription","commits_url":"https://api.github.com/repos/bardsoftware/ace/commits{/sha}","git_commits_url":"https://api.github.com/repos/bardsoftware/ace/git/commits{/sha}","comments_url":"https://api.github.com/repos/bardsoftware/ace/comments{/number}","issue_comment_url":"https://api.github.com/repos/bardsoftware/ace/issues/comments{/number}","contents_url":"https://api.github.com/repos/bardsoftware/ace/contents/{+path}","compare_url":"https://api.github.com/repos/bardsoftware/ace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bardsoftware/ace/merges","archive_url":"https://api.github.com/repos/bardsoftware/ace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bardsoftware/ace/downloads","issues_url":"https://api.github.com/repos/bardsoftware/ace/issues{/number}","pulls_url":"https://api.github.com/repos/bardsoftware/ace/pulls{/number}","milestones_url":"https://api.github.com/repos/bardsoftware/ace/milestones{/number}","notifications_url":"https://api.github.com/repos/bardsoftware/ace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bardsoftware/ace/labels{/name}","releases_url":"https://api.github.com/repos/bardsoftware/ace/releases{/id}","deployments_url":"https://api.github.com/repos/bardsoftware/ace/deployments","created_at":"2013-10-15T13:03:16Z","updated_at":"2016-10-26T16:51:24Z","pushed_at":"2017-04-25T18:35:48Z","git_url":"git://github.com/bardsoftware/ace.git","ssh_url":"git@github.com:bardsoftware/ace.git","clone_url":"https://github.com/bardsoftware/ace.git","svn_url":"https://github.com/bardsoftware/ace","homepage":"http://ace.c9.io","size":37775,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":5,"default_branch":"internship-2016"}},"_links":{"self":{"href":"https://api.github.com/repos/bardsoftware/ace/pulls/120"},"html":{"href":"https://github.com/bardsoftware/ace/pull/120"},"issue":{"href":"https://api.github.com/repos/bardsoftware/ace/issues/120"},"comments":{"href":"https://api.github.com/repos/bardsoftware/ace/issues/120/comments"},"review_comments":{"href":"https://api.github.com/repos/bardsoftware/ace/pulls/120/comments"},"review_comment":{"href":"https://api.github.com/repos/bardsoftware/ace/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bardsoftware/ace/pulls/120/commits"},"statuses":{"href":"https://api.github.com/repos/bardsoftware/ace/statuses/c10dc7e24d631be3fb344199e8871acd5124ddf6"}}}}
{"actor":{"display_login":"khazhoyan"}}