-
Notifications
You must be signed in to change notification settings - Fork 774
[READY] Switch C# completer to Omnisharp-roslyn #1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Official builds of omnisharp-roslyn have been broken on Linux/Mac for several months now due to a build server misconfiguration. I've had to build my own omnisharp to get recent C# support on Linux. |
Codecov Report
@@ Coverage Diff @@
## master #1209 +/- ##
==========================================
- Coverage 97.28% 94.99% -2.29%
==========================================
Files 95 51 -44
Lines 7136 5814 -1322
==========================================
- Hits 6942 5523 -1419
- Misses 194 291 +97 |
Codecov Report
@@ Coverage Diff @@
## master #1209 +/- ##
==========================================
+ Coverage 97.46% 97.61% +0.14%
==========================================
Files 95 96 +1
Lines 7260 8340 +1080
Branches 153 153
==========================================
+ Hits 7076 8141 +1065
- Misses 143 158 +15
Partials 41 41 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
For all the SkipTest( 'Reason' )
chanages you should have used @ExpectedFailure
from test_utils.py
.
What is preventing us from having a working force_semantic
?
Reviewed 12 of 15 files at r1, 5 of 5 files at r3.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @mispencer and @ohjames)
ycmd/completers/cs/cs_completer.py, line 74 at r3 (raw file):
raise RuntimeError( SERVER_NOT_FOUND_MSG.format( self._omnisharp_path ) )
Extra empty line.
ycmd/completers/cs/cs_completer.py, line 111 at r3 (raw file):
enough to do so and it will returns more relevant results. Fallback to use the triggers, which are by default . -> and :: """ if ( self.QueryLengthAboveMinThreshold( request_data ) ):
Unnecessary parens. Also why not just
return ( self.QueryLengthAboveMinThreshold( request_data ) or
super( CsharpCompleter, self ).ShouldUseNowInner( request_data ) )
ycmd/completers/cs/cs_completer.py, line 195 at r3 (raw file):
# no_request_data = True ) ), # 'SetOmnisharpPath' : ( lambda self, request_data, args: # self._SetOmnisharpPath( request_data, args[ 0 ] ) ),
Debugging artifacts?
ycmd/completers/cs/cs_completer.py, line 330 at r3 (raw file):
def _SetOmnisharpPath( self, request_data, omnisharp_path ):
Is this used anywhere?
ycmd/completers/cs/cs_completer.py, line 652 at r3 (raw file):
target = urljoin( self._ServerLocation(), handler ) LOGGER.info( u'Sending request' ) response = requests.post( target,
This should be possible to fit on one line.
ycmd/tests/cs/diagnostics_test.py, line 143 at r3 (raw file):
@SharedYcmd def Diagnostics_HandleZeroColumnDiagnostic_test( app ): raise SkipTest( "No zero column diagnostic in roslyn" )
We could just remove the test if we are sure of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 15 files at r1.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @mispencer and @ohjames)
build.py, line 703 at r3 (raw file):
continue if os.path.isfile( file_path ): os.unlink( file_path )
I'd use os.remove
here, because unlink
makes me think of symbolic links.
build.py, line 753 at r3 (raw file):
if OnMac(): return 'omnisharp.http-osx.tar.gz' elif platform.machine().endswith( '64' ):
No need for elif
or else
after return
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests with SkipTest should either have be removed, or the test should made to work. In either case, they wouldn't have either SkipTest or ExpectedFailure, so I'm not going to worry about this for now.
The old Omnisharp server had two complete modes: a complete-as-you-type mode and explicitly requested mode (i.e you press a keybind like shift-tab). Omnisharp-roslyn doesn't have this feature as far as I am aware, thus I removed the force feature and all the tests for it.
The import feature and its tests were removed for the same reason.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @ohjames)
build.py, line 753 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
No need for
elif
orelse
afterreturn
.
Done.
ycmd/completers/cs/cs_completer.py, line 74 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Extra empty line.
Done.
ycmd/completers/cs/cs_completer.py, line 111 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Unnecessary parens. Also why not just
return ( self.QueryLengthAboveMinThreshold( request_data ) or super( CsharpCompleter, self ).ShouldUseNowInner( request_data ) )
Done.
ycmd/completers/cs/cs_completer.py, line 195 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Debugging artifacts?
I left this here because it was useful for development work on the C# completer, but commented it out since it should not be exposed for normal users. I had originally implemented this prior to omnisharp-roslyn for my own development and can confirm it was useful for me. If you want, however, I can remove the whole variable omnisharp server path feature.
ycmd/completers/cs/cs_completer.py, line 330 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Is this used anywhere?
It isn't exposed anywhere at the moment, but same comment as on the SetOmnisharpPath command applied here.
ycmd/completers/cs/cs_completer.py, line 652 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
This should be possible to fit on one line.
Done.
ycmd/tests/cs/diagnostics_test.py, line 143 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
We could just remove the test if we are sure of this.
I am unaware of any way to get a zero-column from Omnisharp-roslyn, but I cannot say for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Travis failure looks like a flake, so this is mostly ready. There are a few items left to clean up (see my other notes), but this is ready for review again.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @ohjames)
build.py, line 723 at r4 (raw file):
USE_MONO_PACKAGE = False
Need to figure out if we are supporting building using the mono version. If so, need to ensure that the mono version works, and probably should have one of the Travis configuration use it. Else, this feature should be removed, not just flagged out.
run_tests.py, line 260 at r4 (raw file):
env[ 'PATH' ] = LIBCLANG_DIR + ';' + env[ 'PATH' ] elif 'LD_LIBRARY_PATH' in env: env[ 'LD_LIBRARY_PATH' ] = env[ 'LD_LIBRARY_PATH' ] + ':' + LIBCLANG_DIR
This can be removed.
ycmd/tests/cs/diagnostics_test.py, line 183 at r4 (raw file):
app.post_json( '/event_notification', event_data ).json WaitUntilCompleterServerReady( app, 'cs' ) time.sleep( 5 )
Replace this with the logic in __init__
. Probably should be refactored to a function and used in both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @ohjames)
ycmd/tests/cs/init.py, line 103 at r4 (raw file):
shared_filepaths.append( filepath ) WaitUntilCompleterServerReady( app, 'cs' ) time.sleep( 2 )
This sleep can likely be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old Omnisharp server had two complete modes: a complete-as-you-type mode and explicitly requested mode (i.e you press a keybind like shift-tab). Omnisharp-roslyn doesn't have this feature as far as I am aware, thus I removed the force feature and all the tests for it.
I'm not sure I understand. We're still sending the /autocomplete
request to the Roslyn server. So for force_semantic
to work, we just need to have another or request_data[ 'force_semantic
in ShouldUseNowInner()
.
The Travis failure looks like a flake, so this is mostly ready. There are a few items left to clean up (see my other notes), but this is ready for review again.
It definitely was a flake, I restarted it and the tests are passing. Mark the PR as [READY]
, otherwise it won't get as much attention.
Reviewed 9 of 10 files at r4.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @mispencer and @ohjames)
.travis.yml, line 3 at r4 (raw file):
language: generic dist: trusty sudo: false
Why was this removed? I see that you're installing libuv
isn't just adding it to the Travis list of packages:
enough?
build.py, line 673 at r1 (raw file):
Previously, mispencer wrote…
This was allegedly fixed in 1.32.12-beta.51 (which also includes FixIts!). Need to test using that version.
That would be great.
build.py, line 723 at r4 (raw file):
Previously, mispencer wrote…
Need to figure out if we are supporting building using the mono version. If so, need to ensure that the mono version works, and probably should have one of the Travis configuration use it. Else, this feature should be removed, not just flagged out.
Did I understand correctly? Are we talking about building mono
from source or something else?
ycmd/completers/cs/cs_completer.py, line 111 at r3 (raw file):
Previously, mispencer wrote…
Done.
Align super
with self
.
ycmd/completers/cs/cs_completer.py, line 195 at r3 (raw file):
Previously, mispencer wrote…
I left this here because it was useful for development work on the C# completer, but commented it out since it should not be exposed for normal users. I had originally implemented this prior to omnisharp-roslyn for my own development and can confirm it was useful for me. If you want, however, I can remove the whole variable omnisharp server path feature.
There's the debug info, the logger and one can use an actual debugger if needed. I'd prefer a code without "might be useful one day for debugging".
ycmd/tests/cs/init.py, line 103 at r4 (raw file):
Previously, mispencer wrote…
This sleep can likely be removed.
That would be nice, since the tests already take a while to run.
ycmd/tests/cs/init.py, line 112 at r4 (raw file):
except Exception: if i == 19: # i is zero indexed raise
Let's have a real description of the error that happened.
ycmd/tests/cs/diagnostics_test.py, line 143 at r3 (raw file):
Previously, mispencer wrote…
I am unaware of any way to get a zero-column from Omnisharp-roslyn, but I cannot say for sure.
A SkipTest()
for something that we don't know if it can happen doesn't seem useful to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand. We're still sending the /autocomplete request to the Roslyn server. So for force_semantic to work, we just need to have another or request_data[ 'force_semantic in ShouldUseNowInner().
The old Omnisharp would return different result in forced and non-forced mode. This is why that logic to divide the cache and such exists. The new Omnisharp returns the same result, so none of that logic and related are necessary, and thus I removed them.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @ohjames)
.travis.yml, line 3 at r4 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Why was this removed? I see that you're installing
libuv
isn't just adding it to the Travis list ofpackages:
enough?
"sudo: false" was used to opt in to the Travis container environment, but that no longer exists, so it is just a no op. As such, we can use sudo, and I did in the install script. Thus, I removed the "sudo: false" no op, since it would be confusing.
build.py, line 673 at r1 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
That would be great.
Done.
build.py, line 723 at r4 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Did I understand correctly? Are we talking about building
mono
from source or something else?
No. Omnisharp has two different linux/mac packages. One only includes Omnisharp and the other also bundles a Mono instance. We are currently using the package that bundles Mono. My earlier notes were wondering if we should support using the bare package and thus the system mono.
run_tests.py, line 260 at r4 (raw file):
Previously, mispencer wrote…
This can be removed.
Done
ycmd/completers/cs/cs_completer.py, line 111 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Align
super
withself
.
Done
ycmd/completers/cs/cs_completer.py, line 195 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
There's the debug info, the logger and one can use an actual debugger if needed. I'd prefer a code without "might be useful one day for debugging".
The use case for this was using a different Omnisharp binary on the fly. Regardless, I have removed the variable Omnisharp server path feature.
ycmd/tests/cs/init.py, line 103 at r4 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
That would be nice, since the tests already take a while to run.
Done
ycmd/tests/cs/init.py, line 112 at r4 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Let's have a real description of the error that happened.
Not sure what you mean? I refactored this code, so please review it there, and re-comment if need be.
ycmd/tests/cs/diagnostics_test.py, line 143 at r3 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
A
SkipTest()
for something that we don't know if it can happen doesn't seem useful to me.
I removed this test, since I am not aware of any such response from Omnisharp-roslyn.
ycmd/tests/cs/diagnostics_test.py, line 183 at r4 (raw file):
Previously, mispencer wrote…
Replace this with a logic in init. Probably should be refactored to a function and both places.
Done
All the CI passed! It only took 2+ years, 76 commits and 3 PRs! This is READY! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one. Gave it a really quick review. Will need to review more thoroughly .
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic, @mispencer, and @ohjames)
build.py, line 723 at r4 (raw file):
Previously, mispencer wrote…
No. Omnisharp has two different linux/mac packages. One only includes Omnisharp and the other also bundles a Mono instance. We are currently using the package that bundles Mono. My earlier notes were wondering if we should support using the bare package and thus the system mono.
Let’s just pick one and drop the extra unreachable code.
build.py, line 264 at r5 (raw file):
def CheckOutput( args, **kwargs ):
What’s this needed for?
build.py, line 690 at r5 (raw file):
package_path = p.join( version, url_file ) if not p.exists( package_path ): DownloadFileTo( url_pattern.format( version, url_file ), package_path )
We should do a checksum validation on any existing file like jdt and clangd completers
build.py, line 693 at r5 (raw file):
if OnWindows(): extract_command = [ GetSevenZipPath(), 'x', package_path ]
Can we not use the python stuff that is used by jdt.ls installer ? Requiring 7zip is a pain I would like to avoid.
build.py, line 702 at r5 (raw file):
def CleanCsCompleter( build_dir, version ):
this seems overly complex. What we do for jdt.ls seems simple enough.
build.py, line 750 at r5 (raw file):
# TODO - improve this check libuv_output = CheckOutput( [ 'gcc', '-luv' ], stderr = subprocess.STDOUT )
Gcc might not exist or be in the path. Is the check really needed? Can we just write it in the docs?
build.py, line 763 at r5 (raw file):
def ToUnicode( value ):
What’s this needed for?
ycmd/completers/cs/cs_completer.py, line 419 at r5 (raw file):
try: self._GetResponse( '/stopserver', timeout = .5 ) except Exception:
Can this be more specific?
ycmd/completers/cs/cs_completer.py, line 427 at r5 (raw file):
def _ForceStopServer( self ):
We have a utils method for this now I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. This mostly looks good, but like Ben I will give this PR another thorough look.
Reviewed 5 of 5 files at r5.
Dismissed @ohjames from a discussion.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @mispencer)
.travis.yml, line 3 at r4 (raw file):
Previously, mispencer wrote…
"sudo: false" was used to opt in to the Travis container environment, but that no longer exists, so it is just a no op. As such, we can use sudo, and I did in the install script. Thus, I removed the "sudo: false" no op, since it would be confusing.
Still, is just adding libuv
to the packages:
enough or do we have to do this kind of acrobatics?
ycmd/tests/cs/init.py, line 112 at r4 (raw file):
Previously, mispencer wrote…
Not sure what you mean? I refactored this code, so please review it there, and re-comment if need be.
I was talking about raise
vs raise RuntimeError( "Timeout blah blah blah" )
, but since this piece of code is removed, it's fine.
ycmd/tests/cs/init.py, line 101 at r5 (raw file):
try: if len( GetDiagnostics( app, filepath ) ) == 0: raise Exception( "No diagnostic" )
Let's instead throw (and catch) RuntimeError
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to latest Omnisharp release (v1.32.13).
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @puremourning)
.travis.yml, line 3 at r4 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Still, is just adding
libuv
to thepackages:
enough or do we have to do this kind of acrobatics?
It wasn't in the source repo whitelist last I checked. I am copying the Omnisharp travis script logic.
build.py, line 723 at r4 (raw file):
Previously, puremourning (Ben Jackson) wrote…
Let’s just pick one and drop the extra unreachable code.
We are currently used the bundled one, so I dropped support for the non-bundled one.
build.py, line 264 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
What’s this needed for?
Dead code, removed.
build.py, line 690 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
We should do a checksum validation on any existing file like jdt and clangd completers
I am not interested in implementing this at this time. Maybe later when the version is more stable.
build.py, line 693 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
Can we not use the python stuff that is used by jdt.ls installer ? Requiring 7zip is a pain I would like to avoid.
Done.
build.py, line 702 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
this seems overly complex. What we do for jdt.ls seems simple enough.
This logic removed any older versions as well, which is worth the extra couple of lines.
build.py, line 750 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
Gcc might not exist or be in the path. Is the check really needed? Can we just write it in the docs?
Removed both these checks.
build.py, line 763 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
What’s this needed for?
Dead code - removed.
ycmd/completers/cs/cs_completer.py, line 419 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
Can this be more specific?
Exception is used in the other similar checks (e.g. ServerIsReady) so I assume not?
ycmd/completers/cs/cs_completer.py, line 427 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
We have a utils method for this now I think.
I didn't find one?
ycmd/tests/cs/init.py, line 101 at r5 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Let's instead throw (and catch)
RuntimeError
.
Changed throws. We aren't catching RuntimeError because we need to catch errors thrown by GetDiagnostics, which include types outside of RuntimeError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r6.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @mispencer and @puremourning)
.travis.yml, line 3 at r4 (raw file):
Previously, mispencer wrote…
It wasn't in the source repo whitelist last I checked. I am copying the Omnisharp travis script logic.
I /love/ travis whitelist...
ycmd/tests/cs/init.py, line 101 at r5 (raw file):
We aren't catching RuntimeError because we need to catch errors thrown by GetDiagnostics, which include types outside of RuntimeError.
Then let's be explicit and name all exception types that we want to catch, instead of just catching everything and potentially hide a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to latest stable release (v1.32.17)
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @puremourning)
build.py, line 690 at r5 (raw file):
Previously, mispencer wrote…
I am not interested in implementing this at this time. Maybe later when the version is more stable.
This is implemented, as we are now on a stable release.
ycmd/tests/cs/init.py, line 101 at r5 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
We aren't catching RuntimeError because we need to catch errors thrown by GetDiagnostics, which include types outside of RuntimeError.
Then let's be explicit and name all exception types that we want to catch, instead of just catching everything and potentially hide a bug.
I don't know all the possible failure cases. The ServerIsReady and ServerIsHealthy checks on the completer are trapping exception as well for the same reason - how the server will fail when it isn't ready isn't well defined.
More generally, for testing purposes, if the server eventually returns successfully, we don't care why it was failing before. If it isn't ever successful, the final exception will be re-raised regardless of the exception type, so we will properly get a test failure with a usefully error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mispencer What's the status of this? Aren't FixIts now possible?
Reviewed 1 of 3 files at r7.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @puremourning)
FixIt were implemented though the code action endpoint, which we never supported. Additionally, it requires a config flag which is disabled by default and has other possibly undesirable side effects. So I wasn't planning on implementing it in this pull request. I don't currently have any planned changes for this pull request. As far as I am concerned, it is ready to be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, if FixIts are going to be a chore, we can leave them for another PR. I left a few minor comments, but generally, .
Thanks a lot for all the work you put into this.
Reviewed 2 of 3 files at r7.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @mispencer and @puremourning)
update_omnisharp.py, line 24 at r7 (raw file):
if p.isfile( p.join( path, 'os.py' ) ): return index raise RuntimeError( 'Could not find standard library path in Python path.' )
This is how we used to do this, but it wasn't robust enough.
From the server_utils.py
:
def IsStandardLibraryFolder( path ):
return ( ( p.isfile( path )
and PYTHON_STDLIB_ZIP_REGEX.match( p.basename( path ) ) )
or p.isfile( p.join( path, 'os.py' ) ) )
def IsVirtualEnvLibraryFolder( path ):
return p.isfile( p.join( path, 'orig-prefix.txt' ) )
def GetStandardLibraryIndexInSysPath():
for index, path in enumerate( sys.path ):
if ( IsStandardLibraryFolder( path ) and
not IsVirtualEnvLibraryFolder( path ) ):
return index
raise RuntimeError( 'Could not find standard library path in Python path.' )
update_omnisharp.py, line 31 at r7 (raw file):
'requests_deps' ) ) for path in listdir( request_dep_root ): sys.path.insert( 0, p.join( request_dep_root, path ) )
This will add third_party/requests_deps/urllib3
to the path, which isn't a path to a valid python package. I'd prefer to be tidy with things like sys.path
and here the easiest way to do that is just to unroll the loop.
update_omnisharp.py, line 53 at r7 (raw file):
'release': ( "https://github.com/OmniSharp/omnisharp-roslyn/" "releases/download/{version}/{file_name}" ), 'ci': ( "https://roslynomnisharp.blob.core.windows.net/"
Why do we have separate URL for CI?
update_omnisharp.py, line 144 at r7 (raw file):
def Main(): args = ParseArguments() version = args.version
Is there a way to default the version to the latest instead of having to look up what has been released, similar to update_boost.py
?
Not really a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am reluctant to spend much time polishing the update Omnisharp script, given how rarely it will be ran....
Reviewable status: 1 of 2 LGTMs obtained (waiting on @bstaletic and @puremourning)
update_omnisharp.py, line 24 at r7 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
This is how we used to do this, but it wasn't robust enough.
From the
server_utils.py
:def IsStandardLibraryFolder( path ): return ( ( p.isfile( path ) and PYTHON_STDLIB_ZIP_REGEX.match( p.basename( path ) ) ) or p.isfile( p.join( path, 'os.py' ) ) ) def IsVirtualEnvLibraryFolder( path ): return p.isfile( p.join( path, 'orig-prefix.txt' ) ) def GetStandardLibraryIndexInSysPath(): for index, path in enumerate( sys.path ): if ( IsStandardLibraryFolder( path ) and not IsVirtualEnvLibraryFolder( path ) ): return index raise RuntimeError( 'Could not find standard library path in Python path.' )
I just copied it from the clang update script as I recall. The clangs update script also had this code. If it is an issue, it should be changed in all three places in a separate PR.
update_omnisharp.py, line 31 at r7 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
This will add
third_party/requests_deps/urllib3
to the path, which isn't a path to a valid python package. I'd prefer to be tidy with things likesys.path
and here the easiest way to do that is just to unroll the loop.
That is unlike to cause harm. "Added a request dependency" seems like a more likely failure case.
update_omnisharp.py, line 53 at r7 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Why do we have separate URL for CI?
Release are published to GitHub, but pre-release are only published to the CI url. We have had a need to point at pre-release before, hence why it is supported here.
update_omnisharp.py, line 144 at r7 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Is there a way to default the version to the latest instead of having to look up what has been released, similar to
update_boost.py
?Not really a big deal.
Probably, but, given how rarely this script will be used, I don't think the benefit is worth the implementation effort.
That likely applies to all possible polishing to this script.
☔ The latest upstream changes (presumably #1241) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on the surface. I don't use this completer, though so only scanned it mainly.
Thanks @mispencer for your efforts on this!
Reviewed 8 of 15 files at r1, 5 of 10 files at r4, 1 of 5 files at r5, 2 of 4 files at r6, 2 of 3 files at r7, 1 of 1 files at r8.
Reviewable status: 0 of 2 LGTMs obtained (and 1 stale) (waiting on @bstaletic and @mispencer)
ci/travis/travis_install.sh, line 131 at r8 (raw file):
make sudo make install cd $OLDPWD
use pushd/popd
ycmd/completers/cs/cs_completer.py, line 419 at r5 (raw file):
Previously, mispencer wrote…
Exception is used in the other similar checks (e.g. ServerIsReady) so I assume not?
assumption is the mother of all....
ycmd/completers/cs/cs_completer.py, line 427 at r5 (raw file):
Previously, mispencer wrote…
I didn't find one?
utils.TerminateProcesss or something.
ycmd/completers/cs/cs_completer.py, line 367 at r8 (raw file):
command.insert( 0, 'mono' ) LOGGER.info( 'Starting OmniSharp server with: ' + str( command ) )
use LOGGER.info( '.... %s' , command )
ycmd/completers/cs/cs_completer.py, line 618 at r8 (raw file):
""" Handle communication with server """ target = urljoin( self._ServerLocation(), handler ) LOGGER.info( u'Sending request' )
We don't need this, it's too verbose. Consider debug logging that logs the actual message, but just sendin/receiving isn't useful.
Also FWIW the u'
is not required, as we use unicode literals from future.
Any movement on this? Would love to see it merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @bstaletic and @mispencer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 2 of 2 LGTMs obtained (waiting on @bstaletic and @mispencer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 2 of 2 LGTMs obtained (waiting on @bstaletic and @mispencer)
@mispencer Could you rebase the PR? Ycmd has moved to MS Azure devops. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged master. It looks like Rust is failing in Linux? I don't see anything in these changes which would break Rust tests.
Reviewable status: 0 of 2 LGTMs obtained (and 2 stale) (waiting on @bstaletic, @mispencer, and @puremourning)
Rust tests got fixed, please rebase again and squash the commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 6 files at r9, 1 of 1 files at r10, 1 of 1 files at r11.
Dismissed @puremourning from a discussion.
Reviewable status: 0 of 2 LGTMs obtained (and 2 stale) (waiting on @mispencer and @puremourning)
update_omnisharp.py, line 24 at r7 (raw file):
Previously, mispencer wrote…
I just copied it from the clang update script as I recall. The clangs update script also had this code. If it is an issue, it should be changed in all three places in a separate PR.
This isn't really an issue, because users won't be running this script anyway.
ycmd/completers/cs/cs_completer.py, line 427 at r5 (raw file):
Previously, puremourning (Ben Jackson) wrote…
utils.TerminateProcesss or something.
There's WaitUntilProcessIsTerminated
which only waits and eventually raises an exception.
Other than that, I don't see anything useful in utils.py
.
ycmd/completers/cs/cs_completer.py, line 526 at r11 (raw file):
def _GoToReferences( self, request_data ):
Can you add some tests for this? It a great feature, but it adds quite a few lines that currently aren't tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 LGTMs obtained (and 2 stale) (waiting on @bstaletic, @mispencer, and @puremourning)
ycmd/completers/cs/cs_completer.py, line 367 at r8 (raw file):
Previously, puremourning (Ben Jackson) wrote…
use
LOGGER.info( '.... %s' , command )
Done.
ycmd/completers/cs/cs_completer.py, line 618 at r8 (raw file):
Previously, puremourning (Ben Jackson) wrote…
We don't need this, it's too verbose. Consider debug logging that logs the actual message, but just sendin/receiving isn't useful.
Also FWIW the
u'
is not required, as we use unicode literals from future.
Done.
ycmd/completers/cs/cs_completer.py, line 526 at r11 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Can you add some tests for this? It a great feature, but it adds quite a few lines that currently aren't tested.
Oops, I didn't mean to include this commit in this PR It's been reverted. (This likely will be a later PR.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mispencer Can you squash the commits, so that we can merge this?
Reviewed 1 of 1 files at r12.
Reviewable status: 0 of 2 LGTMs obtained (and 2 stale) (waiting on @mispencer and @puremourning)
8c333e2
to
3bf45a3
Compare
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mispencer Please check the tests. On linux/python2.7/no libclang build, the Diagnostics_Basic_test
is consistently returning no diagnostics.
Reviewable status: 0 of 2 LGTMs obtained (and 2 stale) (waiting on @mispencer and @puremourning)
@mispencer The following patch fixes the flaky diagnostic test. diff --git a/ycmd/tests/cs/diagnostics_test.py b/ycmd/tests/cs/diagnostics_test.py
index c541d919..f973b51b 100644
--- a/ycmd/tests/cs/diagnostics_test.py
+++ b/ycmd/tests/cs/diagnostics_test.py
@@ -27,12 +27,15 @@ from hamcrest import ( assert_that, contains, contains_string, equal_to,
from ycmd.tests.cs import ( IsolatedYcmd, PathToTestFile, SharedYcmd,
WrapOmniSharpServer, WaitUntilCsCompleterIsReady )
-from ycmd.tests.test_utils import ( BuildRequest, LocationMatcher,
+from ycmd.tests.test_utils import ( BuildRequest,
+ LocationMatcher,
RangeMatcher,
- StopCompleterServer )
+ StopCompleterServer,
+ WithRetry )
from ycmd.utils import ReadFile
+@WithRetry
@SharedYcmd
def Diagnostics_Basic_test( app ):
filepath = PathToTestFile( 'testy', 'Program.cs' ) Also, rebasing would avoid other flakes too. |
Superseded by #1274 . Thanks again to @mispencer for hard work, determination and patience! |
Switch to new rosyln version of Omnisharp for C# completion.
Missing features:
This change is