Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omnisharp completion not accepting file paths with space #1119

Closed
milizhang opened this issue Aug 6, 2014 · 3 comments
Closed

Omnisharp completion not accepting file paths with space #1119

milizhang opened this issue Aug 6, 2014 · 3 comments

Comments

@milizhang
Copy link

When I try to use Ycm on one of my C# project the Ycm Omnisharp completion stopped working.
I tried to use :YcmDiag in order to find the reason of this issue. However the only thing that I got from that command is:

"URLError: <urlopen error [Errno 61] Connection refused> "

After looking at the log directory of Ycm I found some weird output in the omnisharp logs.

System.IO.FileNotFoundException: Could not find file "/Volumes/Data".
File name: '/Volumes/Data'
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) [0x00000] in <filename unknown>:0
  at System.IO.StreamReader..ctor (System.String path) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
  at System.IO.File.OpenText (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.File.ReadLines (System.String path) [0x00000] in <filename unknown>:0
  at OmniSharp.Solution.CSharpSolution.LoadSolution (System.String fileName) [0x00000] in <filename unknown>:0
  at OmniSharp.Program.StartServer (System.String solutionPath, System.String clientPathMode, Int32 port, Boolean verbose) [0x00000] in <filename unknown>:0

The file path of my project is something like /Volume/Data HD/....., thus I personally think the problem is very likely to be caused by some kind of incorrect space handling.
I am not sure if this is an Omnisharp issue or a Ycm issue. I will take some look at this problem and would really appreciate any hint or help on this.

Thanks.

@metatheos
Copy link

The culprit is in ycmd/completers/cs/cs_completer.py,

path_to_solutionfile = solutiondetection.FindSolutionPath( request_data[ 'filepath' ] )

is computed correctly, but not escaped before being passed on in

  command = ' '.join( [ PATH_TO_OMNISHARP_BINARY,
                         '-p',
                         str( self._omnisharp_port ),
                         '-s',
                         path_to_solutionfile ] )

I'll need to check whether putting quotes around the path is enough to make this work on all platforms (don't have my Windows-machine available right now to test).

@metatheos
Copy link

@milizhang The patch should be in ycm by now. Could you update your copy and verify the issue to be fixed?

@vheon
Copy link
Contributor

vheon commented Aug 29, 2015

I think this has been fixed we have a test for this usecase now Valloric/ycmd/tests/get_completions_test.py#L449 so I think this can be closed. If this isn't the case we will reopen this.

@vheon vheon closed this as completed Aug 29, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants