Skip to content

Commit

Permalink
Skip mono check on Linux with .NET 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaszews committed Aug 7, 2024
1 parent e81c15e commit 846d52b
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions ycmd/completers/cs/cs_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
LOGFILE_FORMAT = 'omnisharp_{port}_{sln}_{std}_'


def MonoRequired( roslyn_path: str ):
return not utils.OnWindows() and roslyn_path.endswith( '.exe' )


def ShouldEnableCsCompleter( user_options ):
user_roslyn_path = user_options[ 'roslyn_binary_path' ]
if user_roslyn_path and not os.path.isfile( user_roslyn_path ):
Expand All @@ -67,12 +71,19 @@ def ShouldEnableCsCompleter( user_options ):
roslyn = user_roslyn_path
else:
roslyn = PATH_TO_OMNISHARP_ROSLYN_BINARY
mono = FindExecutableWithFallback( user_options[ 'mono_binary_path' ],
FindExecutable( 'mono' ) )
if roslyn and ( mono or utils.OnWindows() ):
return True
LOGGER.info( 'No mono executable at %s', mono )
return False

if not roslyn:
LOGGER.info( 'No roslyn executable at %s', roslyn )
return False

if MonoRequired( roslyn ):
mono = FindExecutableWithFallback( user_options[ 'mono_binary_path' ],
FindExecutable( 'mono' ) )
if not mono:
LOGGER.info( 'No mono executable at %s', mono )
return False

return True


class CsharpCompleter( Completer ):
Expand Down Expand Up @@ -438,8 +449,7 @@ def _ConstructOmnisharpCommand( self ):
'-s',
str( self._solution_path ) ]

if ( not utils.OnWindows()
and self._roslyn_path.endswith( '.exe' ) ):
if ( MonoRequired( self._roslyn_path ) ):
self._omnisharp_command.insert( 0, self._mono_path )

return self._omnisharp_command
Expand Down

0 comments on commit 846d52b

Please sign in to comment.