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