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

Try starting Omnisharp server without solution file #1663

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ycmd/completers/cs/cs_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,13 @@ def _GetSolutionFile( self, filepath ):
# to be confirmed
path_to_solutionfile = solutiondetection.FindSolutionPath( filepath )
if not path_to_solutionfile:
raise RuntimeError( 'Autodetection of solution file failed.' )
path_to_solutionfile = os.getcwd()
LOGGER.info( 'Autodetection of solution file failed, '
'trying current directory ({0}).'
.format( path_to_solutionfile ) )
else:
LOGGER.info( 'Loading solution file {0}'
.format( path_to_solutionfile ) )
self._solution_for_file[ filepath ] = path_to_solutionfile

return self._solution_for_file[ filepath ]
Expand Down
13 changes: 7 additions & 6 deletions ycmd/tests/cs/debug_info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,21 @@ def test_DebugInfo_ServerIsRunning( self, app ):


@SharedYcmd
def test_DebugInfo_ServerIsNotRunning_NoSolution( self, app ):
def test_DebugInfo_ServerIsRunning_NoSolution( self, app ):
request_data = BuildRequest( filetype = 'cs' )
assert_that(
app.post_json( '/debug_info', request_data ).json,
has_entry( 'completer', has_entries( {
'name': 'C#',
'servers': contains_exactly( has_entries( {
'name': 'OmniSharp',
'is_running': False,
'is_running': True,
'executable': instance_of( str ),
'pid': None,
'address': None,
'port': None,
'logfiles': empty()
'pid': instance_of( int ),
'address': instance_of( str ),
'port': instance_of( int ),
'logfiles': contains_exactly( instance_of( str ),
instance_of( str ) )
} ) ),
'items': empty()
} ) )
Expand Down
21 changes: 0 additions & 21 deletions ycmd/tests/cs/get_completions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,24 +172,3 @@ def test_GetCompletions_PathWithSpace( self, app ):
),
'errors': empty(),
} ) )


@SharedYcmd
def test_GetCompletions_DoesntStartWithAmbiguousMultipleSolutions(
self, app ):
filepath = PathToTestFile( 'testy-multiple-solutions',
'solution-not-named-like-folder',
'testy', 'Program.cs' )
contents = ReadFile( filepath )
event_data = BuildRequest( filepath = filepath,
filetype = 'cs',
contents = contents,
event_name = 'FileReadyToParse' )

assert_that(
calling( app.post_json ).with_args( '/event_notification', event_data ),
raises( AppError, 'Autodetection of solution file failed' ),
"The Omnisharp server started, despite us not being able to find a "
"suitable solution file to feed it. Did you fiddle with the solution "
"finding code in cs_completer.py? Hopefully you've enhanced it: you need "
"to update this test then :)" )