{"action":"created","issue":{"url":"https://api.github.com/repos/Valloric/ycmd/issues/210","labels_url":"https://api.github.com/repos/Valloric/ycmd/issues/210/labels{/name}","comments_url":"https://api.github.com/repos/Valloric/ycmd/issues/210/comments","events_url":"https://api.github.com/repos/Valloric/ycmd/issues/210/events","html_url":"https://github.com/Valloric/ycmd/pull/210","id":103930026,"number":210,"title":"Use client working directory if supplied for filename completer","user":{"login":"puremourning","id":10584846,"avatar_url":"https://avatars.githubusercontent.com/u/10584846?v=3","gravatar_id":"","url":"https://api.github.com/users/puremourning","html_url":"https://github.com/puremourning","followers_url":"https://api.github.com/users/puremourning/followers","following_url":"https://api.github.com/users/puremourning/following{/other_user}","gists_url":"https://api.github.com/users/puremourning/gists{/gist_id}","starred_url":"https://api.github.com/users/puremourning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puremourning/subscriptions","organizations_url":"https://api.github.com/users/puremourning/orgs","repos_url":"https://api.github.com/users/puremourning/repos","events_url":"https://api.github.com/users/puremourning/events{/privacy}","received_events_url":"https://api.github.com/users/puremourning/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-30T15:14:55Z","updated_at":"2015-08-30T17:16:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Valloric/ycmd/pulls/210","html_url":"https://github.com/Valloric/ycmd/pull/210","diff_url":"https://github.com/Valloric/ycmd/pull/210.diff","patch_url":"https://github.com/Valloric/ycmd/pull/210.patch"},"body":"Background\r\n====\r\n\r\nFixes: https://github.com/Valloric/YouCompleteMe/issues/1655\r\n\r\nThe documentation for YouCompleteMe says:\r\n\r\n>The g:ycm_filepath_completion_use_working_dir option\r\n\r\n> By default, YCM's filepath completion will interpret relative paths like ../ as being relative to the folder of the file of the currently active buffer. Setting this option will force YCM to always interpret relative paths as being relative to Vim's current working directory.\r\n\r\n> Default: 0\r\n\r\n>  let g:ycm_filepath_completion_use_working_dir = 0\r\n\r\nBut previously, only the working directory of `ycmd` was used. This meant that operations like changing the working directory of the client were not reflected in completion suggestions.\r\n\r\nWhat this change does\r\n====\r\n\r\nThe client can now (optionally) pass a `working_dir` property to the '/completions' request which is respected by the filename completer (and potentially any other completer should it be useful). If `working_dir` is not supplied, the previous behaviour remains.\r\n\r\nAPI Changes\r\n====\r\n\r\nThe `/completions` request data now allows an optional `working_dir` parameter containing the _absolute path_ to the working directory of the client.\r\n\r\nTesting\r\n====\r\n\r\nAdded new tests to the `filename_completer_test`. See also trivial manual test cases on the linked issue. The one remaining question is about the performance of the `os.getcwd` call on each request, but it probably pales into insignificance compared to the performance of the vimscript, and in particular the IO operations performed by the filename completer itself.\r\n\r\nThis only addresses the 'standard' case for filename completer, as the 'include' case already has its own logic for relative paths and there are already auto tests for that.\r\n\r\nRelated\r\n====\r\n\r\nThere is a related (trivial) change to YouCompleteMe: https://github.com/Valloric/YouCompleteMe/pull/1659"},"comment":{"url":"https://api.github.com/repos/Valloric/ycmd/issues/comments/136161320","html_url":"https://github.com/Valloric/ycmd/pull/210#issuecomment-136161320","issue_url":"https://api.github.com/repos/Valloric/ycmd/issues/210","id":136161320,"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},"created_at":"2015-08-30T17:16:04Z","updated_at":"2015-08-30T17:16:04Z","body":"This is now LGTM from me (conditional on inline comments being resolved, of course)."}}