56
56
LOGFILE_FORMAT = 'omnisharp_{port}_{sln}_{std}_'
57
57
58
58
59
+ def MonoRequired ( roslyn_path : str ):
60
+ return not utils .OnWindows () and roslyn_path .endswith ( '.exe' )
61
+
62
+
59
63
def ShouldEnableCsCompleter ( user_options ):
60
64
user_roslyn_path = user_options [ 'roslyn_binary_path' ]
61
65
if user_roslyn_path and not os .path .isfile ( user_roslyn_path ):
@@ -67,12 +71,19 @@ def ShouldEnableCsCompleter( user_options ):
67
71
roslyn = user_roslyn_path
68
72
else :
69
73
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
76
87
77
88
78
89
class CsharpCompleter ( Completer ):
@@ -438,8 +449,7 @@ def _ConstructOmnisharpCommand( self ):
438
449
'-s' ,
439
450
str ( self ._solution_path ) ]
440
451
441
- if ( not utils .OnWindows ()
442
- and self ._roslyn_path .endswith ( '.exe' ) ):
452
+ if ( MonoRequired ( self ._roslyn_path ) ):
443
453
self ._omnisharp_command .insert ( 0 , self ._mono_path )
444
454
445
455
return self ._omnisharp_command
0 commit comments