{"action":"created","comment":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/comments/38273825","id":38273825,"diff_hunk":"@@ -503,3 +518,27 @@ def ReplaceChunk( start, end, replacement_text, line_delta, char_delta,\n \n   new_line_delta = replacement_lines_count - source_lines_count\n   return ( new_line_delta, new_char_delta )\n+\n+\n+def InsertNamespace( namespace ):\n+  if VariableExists( 'g:ycm_cs_insert_namespace_function' ):","path":"python/ycm/vimsupport.py","position":53,"original_position":53,"commit_id":"dd27184970ea54d7e31f7ff2ed5d7b630c532341","original_commit_id":"dd27184970ea54d7e31f7ff2ed5d7b630c532341","user":{"login":"Valloric","id":919444,"avatar_url":"https://avatars.githubusercontent.com/u/919444?v=3","gravatar_id":"","url":"https://api.github.com/users/Valloric","html_url":"https://github.com/Valloric","followers_url":"https://api.github.com/users/Valloric/followers","following_url":"https://api.github.com/users/Valloric/following{/other_user}","gists_url":"https://api.github.com/users/Valloric/gists{/gist_id}","starred_url":"https://api.github.com/users/Valloric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Valloric/subscriptions","organizations_url":"https://api.github.com/users/Valloric/orgs","repos_url":"https://api.github.com/users/Valloric/repos","events_url":"https://api.github.com/users/Valloric/events{/privacy}","received_events_url":"https://api.github.com/users/Valloric/received_events","type":"User","site_admin":false},"body":"We also need README docs for the new option.","created_at":"2015-08-30T17:28:23Z","updated_at":"2015-08-30T17:28:23Z","html_url":"https://github.com/Valloric/YouCompleteMe/pull/1636#discussion_r38273825","pull_request_url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636","_links":{"self":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/comments/38273825"},"html":{"href":"https://github.com/Valloric/YouCompleteMe/pull/1636#discussion_r38273825"},"pull_request":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636"}}},"pull_request":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636","id":42727666,"html_url":"https://github.com/Valloric/YouCompleteMe/pull/1636","diff_url":"https://github.com/Valloric/YouCompleteMe/pull/1636.diff","patch_url":"https://github.com/Valloric/YouCompleteMe/pull/1636.patch","issue_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1636","number":1636,"state":"open","locked":false,"title":"Add required namespace in C# after completing","user":{"login":"mispencer","id":1434266,"avatar_url":"https://avatars.githubusercontent.com/u/1434266?v=3","gravatar_id":"","url":"https://api.github.com/users/mispencer","html_url":"https://github.com/mispencer","followers_url":"https://api.github.com/users/mispencer/followers","following_url":"https://api.github.com/users/mispencer/following{/other_user}","gists_url":"https://api.github.com/users/mispencer/gists{/gist_id}","starred_url":"https://api.github.com/users/mispencer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mispencer/subscriptions","organizations_url":"https://api.github.com/users/mispencer/orgs","repos_url":"https://api.github.com/users/mispencer/repos","events_url":"https://api.github.com/users/mispencer/events{/privacy}","received_events_url":"https://api.github.com/users/mispencer/received_events","type":"User","site_admin":false},"body":"When forcing semantic completion with the keybind, C# completions can return a list of importable types. These types are from namespaces which havn't been imported, and thus are not valid to use without also adding their namespace's import statement. This change makes YCM automatically insert the necessary using statement to import that namespace on completion completion. In the case there are multiple possible namespaces, it prompts you to choose one.\r\n\r\nDemo:\r\n![c namespaceinsertdemo](https://cloud.githubusercontent.com/assets/1434266/9337289/b7994542-459b-11e5-8f52-e48af76a3aab.gif)\r\n\r\nBy default, the using statement is inserted after the last using statement. If there aren't any, it's inserted before the first line. This behavior is customization by setting a function to the vim global ``g:ycm_cs_insert_namespace_function``. I implemented this in pure vimscript largely so I could provide such customization...\r\n\r\nCaveats: vim does not provide a way to get which completion was inserted. To get this, we store the completions, hook the CompleteDone event, and check than if the preceding text matches any of the completions. This is imperfect, and sometimes matches when it shouldn't. Also, the CompleteDone event requires 7.3.598 or newer.","created_at":"2015-08-18T17:49:21Z","updated_at":"2015-08-30T17:28:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b27d79e8668d443ff0586cc79261c798e24ee5b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636/commits","review_comments_url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636/comments","review_comment_url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1636/comments","statuses_url":"https://api.github.com/repos/Valloric/YouCompleteMe/statuses/dd27184970ea54d7e31f7ff2ed5d7b630c532341","head":{"label":"mispencer:CsAddImport","ref":"CsAddImport","sha":"dd27184970ea54d7e31f7ff2ed5d7b630c532341","user":{"login":"mispencer","id":1434266,"avatar_url":"https://avatars.githubusercontent.com/u/1434266?v=3","gravatar_id":"","url":"https://api.github.com/users/mispencer","html_url":"https://github.com/mispencer","followers_url":"https://api.github.com/users/mispencer/followers","following_url":"https://api.github.com/users/mispencer/following{/other_user}","gists_url":"https://api.github.com/users/mispencer/gists{/gist_id}","starred_url":"https://api.github.com/users/mispencer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mispencer/subscriptions","organizations_url":"https://api.github.com/users/mispencer/orgs","repos_url":"https://api.github.com/users/mispencer/repos","events_url":"https://api.github.com/users/mispencer/events{/privacy}","received_events_url":"https://api.github.com/users/mispencer/received_events","type":"User","site_admin":false},"repo":{"id":11378299,"name":"YouCompleteMe","full_name":"mispencer/YouCompleteMe","owner":{"login":"mispencer","id":1434266,"avatar_url":"https://avatars.githubusercontent.com/u/1434266?v=3","gravatar_id":"","url":"https://api.github.com/users/mispencer","html_url":"https://github.com/mispencer","followers_url":"https://api.github.com/users/mispencer/followers","following_url":"https://api.github.com/users/mispencer/following{/other_user}","gists_url":"https://api.github.com/users/mispencer/gists{/gist_id}","starred_url":"https://api.github.com/users/mispencer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mispencer/subscriptions","organizations_url":"https://api.github.com/users/mispencer/orgs","repos_url":"https://api.github.com/users/mispencer/repos","events_url":"https://api.github.com/users/mispencer/events{/privacy}","received_events_url":"https://api.github.com/users/mispencer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mispencer/YouCompleteMe","description":"A code-completion engine for Vim","fork":true,"url":"https://api.github.com/repos/mispencer/YouCompleteMe","forks_url":"https://api.github.com/repos/mispencer/YouCompleteMe/forks","keys_url":"https://api.github.com/repos/mispencer/YouCompleteMe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mispencer/YouCompleteMe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mispencer/YouCompleteMe/teams","hooks_url":"https://api.github.com/repos/mispencer/YouCompleteMe/hooks","issue_events_url":"https://api.github.com/repos/mispencer/YouCompleteMe/issues/events{/number}","events_url":"https://api.github.com/repos/mispencer/YouCompleteMe/events","assignees_url":"https://api.github.com/repos/mispencer/YouCompleteMe/assignees{/user}","branches_url":"https://api.github.com/repos/mispencer/YouCompleteMe/branches{/branch}","tags_url":"https://api.github.com/repos/mispencer/YouCompleteMe/tags","blobs_url":"https://api.github.com/repos/mispencer/YouCompleteMe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mispencer/YouCompleteMe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mispencer/YouCompleteMe/git/refs{/sha}","trees_url":"https://api.github.com/repos/mispencer/YouCompleteMe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mispencer/YouCompleteMe/statuses/{sha}","languages_url":"https://api.github.com/repos/mispencer/YouCompleteMe/languages","stargazers_url":"https://api.github.com/repos/mispencer/YouCompleteMe/stargazers","contributors_url":"https://api.github.com/repos/mispencer/YouCompleteMe/contributors","subscribers_url":"https://api.github.com/repos/mispencer/YouCompleteMe/subscribers","subscription_url":"https://api.github.com/repos/mispencer/YouCompleteMe/subscription","commits_url":"https://api.github.com/repos/mispencer/YouCompleteMe/commits{/sha}","git_commits_url":"https://api.github.com/repos/mispencer/YouCompleteMe/git/commits{/sha}","comments_url":"https://api.github.com/repos/mispencer/YouCompleteMe/comments{/number}","issue_comment_url":"https://api.github.com/repos/mispencer/YouCompleteMe/issues/comments{/number}","contents_url":"https://api.github.com/repos/mispencer/YouCompleteMe/contents/{+path}","compare_url":"https://api.github.com/repos/mispencer/YouCompleteMe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mispencer/YouCompleteMe/merges","archive_url":"https://api.github.com/repos/mispencer/YouCompleteMe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mispencer/YouCompleteMe/downloads","issues_url":"https://api.github.com/repos/mispencer/YouCompleteMe/issues{/number}","pulls_url":"https://api.github.com/repos/mispencer/YouCompleteMe/pulls{/number}","milestones_url":"https://api.github.com/repos/mispencer/YouCompleteMe/milestones{/number}","notifications_url":"https://api.github.com/repos/mispencer/YouCompleteMe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mispencer/YouCompleteMe/labels{/name}","releases_url":"https://api.github.com/repos/mispencer/YouCompleteMe/releases{/id}","created_at":"2013-07-12T21:18:26Z","updated_at":"2015-04-24T22:03:49Z","pushed_at":"2015-08-28T16:05:51Z","git_url":"git://github.com/mispencer/YouCompleteMe.git","ssh_url":"git@github.com:mispencer/YouCompleteMe.git","clone_url":"https://github.com/mispencer/YouCompleteMe.git","svn_url":"https://github.com/mispencer/YouCompleteMe","homepage":"http://valloric.github.io/YouCompleteMe/","size":29999,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"Valloric:master","ref":"master","sha":"b5bf25564c40c8c9f37f3c7aec44bd180b22122f","user":{"login":"Valloric","id":919444,"avatar_url":"https://avatars.githubusercontent.com/u/919444?v=3","gravatar_id":"","url":"https://api.github.com/users/Valloric","html_url":"https://github.com/Valloric","followers_url":"https://api.github.com/users/Valloric/followers","following_url":"https://api.github.com/users/Valloric/following{/other_user}","gists_url":"https://api.github.com/users/Valloric/gists{/gist_id}","starred_url":"https://api.github.com/users/Valloric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Valloric/subscriptions","organizations_url":"https://api.github.com/users/Valloric/orgs","repos_url":"https://api.github.com/users/Valloric/repos","events_url":"https://api.github.com/users/Valloric/events{/privacy}","received_events_url":"https://api.github.com/users/Valloric/received_events","type":"User","site_admin":false},"repo":{"id":4037197,"name":"YouCompleteMe","full_name":"Valloric/YouCompleteMe","owner":{"login":"Valloric","id":919444,"avatar_url":"https://avatars.githubusercontent.com/u/919444?v=3","gravatar_id":"","url":"https://api.github.com/users/Valloric","html_url":"https://github.com/Valloric","followers_url":"https://api.github.com/users/Valloric/followers","following_url":"https://api.github.com/users/Valloric/following{/other_user}","gists_url":"https://api.github.com/users/Valloric/gists{/gist_id}","starred_url":"https://api.github.com/users/Valloric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Valloric/subscriptions","organizations_url":"https://api.github.com/users/Valloric/orgs","repos_url":"https://api.github.com/users/Valloric/repos","events_url":"https://api.github.com/users/Valloric/events{/privacy}","received_events_url":"https://api.github.com/users/Valloric/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Valloric/YouCompleteMe","description":"A code-completion engine for Vim","fork":false,"url":"https://api.github.com/repos/Valloric/YouCompleteMe","forks_url":"https://api.github.com/repos/Valloric/YouCompleteMe/forks","keys_url":"https://api.github.com/repos/Valloric/YouCompleteMe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Valloric/YouCompleteMe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Valloric/YouCompleteMe/teams","hooks_url":"https://api.github.com/repos/Valloric/YouCompleteMe/hooks","issue_events_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/events{/number}","events_url":"https://api.github.com/repos/Valloric/YouCompleteMe/events","assignees_url":"https://api.github.com/repos/Valloric/YouCompleteMe/assignees{/user}","branches_url":"https://api.github.com/repos/Valloric/YouCompleteMe/branches{/branch}","tags_url":"https://api.github.com/repos/Valloric/YouCompleteMe/tags","blobs_url":"https://api.github.com/repos/Valloric/YouCompleteMe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Valloric/YouCompleteMe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Valloric/YouCompleteMe/git/refs{/sha}","trees_url":"https://api.github.com/repos/Valloric/YouCompleteMe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Valloric/YouCompleteMe/statuses/{sha}","languages_url":"https://api.github.com/repos/Valloric/YouCompleteMe/languages","stargazers_url":"https://api.github.com/repos/Valloric/YouCompleteMe/stargazers","contributors_url":"https://api.github.com/repos/Valloric/YouCompleteMe/contributors","subscribers_url":"https://api.github.com/repos/Valloric/YouCompleteMe/subscribers","subscription_url":"https://api.github.com/repos/Valloric/YouCompleteMe/subscription","commits_url":"https://api.github.com/repos/Valloric/YouCompleteMe/commits{/sha}","git_commits_url":"https://api.github.com/repos/Valloric/YouCompleteMe/git/commits{/sha}","comments_url":"https://api.github.com/repos/Valloric/YouCompleteMe/comments{/number}","issue_comment_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/comments{/number}","contents_url":"https://api.github.com/repos/Valloric/YouCompleteMe/contents/{+path}","compare_url":"https://api.github.com/repos/Valloric/YouCompleteMe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Valloric/YouCompleteMe/merges","archive_url":"https://api.github.com/repos/Valloric/YouCompleteMe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Valloric/YouCompleteMe/downloads","issues_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues{/number}","pulls_url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls{/number}","milestones_url":"https://api.github.com/repos/Valloric/YouCompleteMe/milestones{/number}","notifications_url":"https://api.github.com/repos/Valloric/YouCompleteMe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Valloric/YouCompleteMe/labels{/name}","releases_url":"https://api.github.com/repos/Valloric/YouCompleteMe/releases{/id}","created_at":"2012-04-16T03:12:14Z","updated_at":"2015-08-30T15:01:25Z","pushed_at":"2015-08-30T17:16:44Z","git_url":"git://github.com/Valloric/YouCompleteMe.git","ssh_url":"git@github.com:Valloric/YouCompleteMe.git","clone_url":"https://github.com/Valloric/YouCompleteMe.git","svn_url":"https://github.com/Valloric/YouCompleteMe","homepage":"http://valloric.github.io/YouCompleteMe/","size":39032,"stargazers_count":8342,"watchers_count":8342,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":952,"mirror_url":null,"open_issues_count":59,"forks":952,"open_issues":59,"watchers":8342,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636"},"html":{"href":"https://github.com/Valloric/YouCompleteMe/pull/1636"},"issue":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1636"},"comments":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1636/comments"},"review_comments":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636/comments"},"review_comment":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1636/commits"},"statuses":{"href":"https://api.github.com/repos/Valloric/YouCompleteMe/statuses/dd27184970ea54d7e31f7ff2ed5d7b630c532341"}}}}