Skip to content

Commit 846d52b

Browse files
committed
Skip mono check on Linux with .NET 6.0
1 parent e81c15e commit 846d52b

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

ycmd/completers/cs/cs_completer.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
LOGFILE_FORMAT = 'omnisharp_{port}_{sln}_{std}_'
5757

5858

59+
def MonoRequired( roslyn_path: str ):
60+
return not utils.OnWindows() and roslyn_path.endswith( '.exe' )
61+
62+
5963
def ShouldEnableCsCompleter( user_options ):
6064
user_roslyn_path = user_options[ 'roslyn_binary_path' ]
6165
if user_roslyn_path and not os.path.isfile( user_roslyn_path ):
@@ -67,12 +71,19 @@ def ShouldEnableCsCompleter( user_options ):
6771
roslyn = user_roslyn_path
6872
else:
6973
roslyn = PATH_TO_OMNISHARP_ROSLYN_BINARY
70-
mono = FindExecutableWithFallback( user_options[ 'mono_binary_path' ],
71-
FindExecutable( 'mono' ) )
72-
if roslyn and ( mono or utils.OnWindows() ):
73-
return True
74-
LOGGER.info( 'No mono executable at %s', mono )
75-
return False
74+
75+
if not roslyn:
76+
LOGGER.info( 'No roslyn executable at %s', roslyn )
77+
return False
78+
79+
if MonoRequired( roslyn ):
80+
mono = FindExecutableWithFallback( user_options[ 'mono_binary_path' ],
81+
FindExecutable( 'mono' ) )
82+
if not mono:
83+
LOGGER.info( 'No mono executable at %s', mono )
84+
return False
85+
86+
return True
7687

7788

7889
class CsharpCompleter( Completer ):
@@ -438,8 +449,7 @@ def _ConstructOmnisharpCommand( self ):
438449
'-s',
439450
str( self._solution_path ) ]
440451

441-
if ( not utils.OnWindows()
442-
and self._roslyn_path.endswith( '.exe' ) ):
452+
if ( MonoRequired( self._roslyn_path ) ):
443453
self._omnisharp_command.insert( 0, self._mono_path )
444454

445455
return self._omnisharp_command

0 commit comments

Comments
 (0)