Skip to content

Commit 4ebe019

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

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

ycmd/completers/cs/cs_completer.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
os.path.join( PATH_TO_ROSLYN_OMNISHARP, 'omnisharp', 'OmniSharp.exe' ) )
5656
LOGFILE_FORMAT = 'omnisharp_{port}_{sln}_{std}_'
5757

58+
def MonoRequired( roslyn_path: str ):
59+
return not utils.OnWindows() and roslyn_path.endswith( '.exe' )
60+
5861

5962
def ShouldEnableCsCompleter( user_options ):
6063
user_roslyn_path = user_options[ 'roslyn_binary_path' ]
@@ -67,12 +70,19 @@ def ShouldEnableCsCompleter( user_options ):
6770
roslyn = user_roslyn_path
6871
else:
6972
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
73+
74+
if not roslyn:
75+
LOGGER.info( 'No roslyn executable at %s', roslyn )
76+
return False
77+
78+
if MonoRequired( roslyn ):
79+
mono = FindExecutableWithFallback( user_options[ 'mono_binary_path' ],
80+
FindExecutable( 'mono' ) )
81+
if not mono:
82+
LOGGER.info( 'No mono executable at %s', mono )
83+
return False
84+
85+
return True
7686

7787

7888
class CsharpCompleter( Completer ):
@@ -438,8 +448,7 @@ def _ConstructOmnisharpCommand( self ):
438448
'-s',
439449
str( self._solution_path ) ]
440450

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

445454
return self._omnisharp_command

0 commit comments

Comments
 (0)