-
Notifications
You must be signed in to change notification settings - Fork 770
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
Bump JDT.ls version to 1.31.0 #1727
Conversation
This should solve the GoTo tests: diff --git a/ycmd/tests/java/subcommands_test.py b/ycmd/tests/java/subcommands_test.py
index 02af0ae03..39fed0c0b 100644
--- a/ycmd/tests/java/subcommands_test.py
+++ b/ycmd/tests/java/subcommands_test.py
@@ -537,6 +537,37 @@ class SubcommandsTest( TestCase ):
ErrorMatcher( RuntimeError, 'Unknown type' ) )
+ @SharedYcmd
+ def test_Subcommands_GoToDeclaration_NoLocation( self, app ):
+ filepath = PathToTestFile( 'simple_eclipse_project',
+ 'src',
+ 'com',
+ 'test',
+ 'TestLauncher.java' )
+ contents = ReadFile( filepath )
+
+ # Virtual call of getWidgetInfo - don't know the concrete implementation.
+ # Here GoToDefinition jumps to the interface method declaration and
+ # GoToDeclaration does nothing...
+ event_data = BuildRequest( filepath = filepath,
+ filetype = 'java',
+ line_num = 34,
+ column_num = 59,
+ contents = contents,
+ command_arguments = [ 'GoToDeclaration' ],
+ completer_target = 'filetype_default' )
+
+ response = app.post_json( '/run_completer_command',
+ event_data,
+ expect_errors = True )
+
+ assert_that( response.status_code,
+ equal_to( requests.codes.internal_server_error ) )
+
+ assert_that( response.json,
+ ErrorMatcher( RuntimeError, 'Cannot jump to location' ) )
+
+
@WithRetry()
@SharedYcmd
def test_Subcommands_GoTo_NoLocation( self, app ):
@@ -2012,7 +2043,7 @@ class SubcommandsTest( TestCase ):
'filepath': TEST_JAVA },
'description': 'GoTo works for unicode identifiers' }
],
- [ 'GoTo', 'GoToDefinition', 'GoToDeclaration' ] ):
+ [ 'GoTo', 'GoToDefinition' ] ):
with self.subTest( command = command, test = test ):
RunGoToTest( app,
test[ 'description' ],
@@ -2023,6 +2054,31 @@ class SubcommandsTest( TestCase ):
has_entries( test[ 'response' ] ) )
+ @SharedYcmd
+ def test_Subcommands_GoToDeclaration( self, app ):
+ source = PathToTestFile( 'simple_eclipse_project',
+ 'src',
+ 'com',
+ 'test',
+ 'TestWidgetImpl.java' )
+ destination = PathToTestFile( 'simple_eclipse_project',
+ 'src',
+ 'com',
+ 'test',
+ 'AbstractTestWidget.java' )
+ # Seems to be the only place GoToDeclaration actually works.
+ RunGoToTest( app,
+ 'GoToDeclaration works on an override definition.',
+ source,
+ 23,
+ 17,
+ 'GoToDeclaration',
+ has_entries( {
+ 'line_num': 17,
+ 'column_num': 17,
+ 'filepath': destination } ) )
+
+
@SharedYcmd
def test_Subcommands_GoToType( self, app ):
for test in [ |
And here's the diff for all the failing tests: diff --git a/ycmd/tests/java/subcommands_test.py b/ycmd/tests/java/subcommands_test.py
index 02af0ae03..d31657b26 100644
--- a/ycmd/tests/java/subcommands_test.py
+++ b/ycmd/tests/java/subcommands_test.py
@@ -537,6 +537,37 @@ class SubcommandsTest( TestCase ):
ErrorMatcher( RuntimeError, 'Unknown type' ) )
+ @SharedYcmd
+ def test_Subcommands_GoToDeclaration_NoLocation( self, app ):
+ filepath = PathToTestFile( 'simple_eclipse_project',
+ 'src',
+ 'com',
+ 'test',
+ 'TestLauncher.java' )
+ contents = ReadFile( filepath )
+
+ # Virtual call of getWidgetInfo - don't know the concrete implementation.
+ # Here GoToDefinition jumps to the interface method declaration and
+ # GoToDeclaration does nothing...
+ event_data = BuildRequest( filepath = filepath,
+ filetype = 'java',
+ line_num = 34,
+ column_num = 59,
+ contents = contents,
+ command_arguments = [ 'GoToDeclaration' ],
+ completer_target = 'filetype_default' )
+
+ response = app.post_json( '/run_completer_command',
+ event_data,
+ expect_errors = True )
+
+ assert_that( response.status_code,
+ equal_to( requests.codes.internal_server_error ) )
+
+ assert_that( response.json,
+ ErrorMatcher( RuntimeError, 'Cannot jump to location' ) )
+
+
@WithRetry()
@SharedYcmd
def test_Subcommands_GoTo_NoLocation( self, app ):
@@ -1020,9 +1051,11 @@ class SubcommandsTest( TestCase ):
'text': "Create constant 'Wibble'",
'kind': 'quickfix',
'chunks': contains_exactly(
- ChunkMatcher( '\n\nprivate static final String Wibble = null;',
+ ChunkMatcher( '\n\nprivate static final String Wibble = null;'
+ '\n\n private void Wimble( Wibble w ) {'
+ '\n if ( w == Wibble',
LocationMatcher( filepath, 16, 4 ),
- LocationMatcher( filepath, 16, 4 ) ),
+ LocationMatcher( filepath, 19, 21 ) ),
),
} ),
has_entries( {
@@ -1056,27 +1089,29 @@ class SubcommandsTest( TestCase ):
'text': "Create local variable 'Wibble'",
'kind': 'quickfix',
'chunks': contains_exactly(
- ChunkMatcher( 'Object Wibble;\n ',
+ ChunkMatcher( 'Object Wibble;\n if ( w == Wibble',
LocationMatcher( filepath, 19, 5 ),
- LocationMatcher( filepath, 19, 5 ) ),
+ LocationMatcher( filepath, 19, 21 ) ),
),
} ),
has_entries( {
'text': "Create field 'Wibble'",
'kind': 'quickfix',
'chunks': contains_exactly(
- ChunkMatcher( '\n\nprivate Object Wibble;',
+ ChunkMatcher( '\n\nprivate Object Wibble;'
+ '\n\n private void Wimble( Wibble w ) {'
+ '\n if ( w == Wibble',
LocationMatcher( filepath, 16, 4 ),
- LocationMatcher( filepath, 16, 4 ) ),
+ LocationMatcher( filepath, 19, 21 ) ),
),
} ),
has_entries( {
'text': "Create parameter 'Wibble'",
'kind': 'quickfix',
'chunks': contains_exactly(
- ChunkMatcher( ', Object Wibble',
+ ChunkMatcher( ', Object Wibble ) {\n if ( w == Wibble',
LocationMatcher( filepath, 18, 32 ),
- LocationMatcher( filepath, 18, 32 ) ),
+ LocationMatcher( filepath, 19, 21 ) ),
),
} ),
has_entries( {
@@ -1485,6 +1520,10 @@ class SubcommandsTest( TestCase ):
has_entries( {
'text': "Sort Members for 'TestLauncher.java'"
} ),
+ has_entries( {
+ 'text': 'Surround with try/catch',
+ 'chunks': instance_of( list )
+ } ),
)
} )
}
@@ -1545,8 +1584,17 @@ class SubcommandsTest( TestCase ):
'text': "Create method 'doUnicødeTes(String)'",
'kind': 'quickfix',
'chunks': contains_exactly(
- ChunkMatcher( 'private void doUnicødeTes(String test2) {\n}\n\n\n',
- LocationMatcher( TEST_JAVA, 20, 3 ),
+ ChunkMatcher(
+ 'doUnicødeTes( test );\n\n'
+ ' TéstClass tésting_with_unicøde = new TéstClass();\n'
+ ' return tésting_with_unicøde.a_test;\n'
+ ' }\n\n\n'
+ ' private void doUnicødeTes(String test2) {\n'
+ ' // TODO Auto-generated method stub\n'
+ ' throw new UnsupportedOperationException('
+ '"Unimplemented method \'doUnicødeTes\'");\n'
+ '}\n\n\n',
+ LocationMatcher( TEST_JAVA, 13, 10 ),
LocationMatcher( TEST_JAVA, 20, 3 ) ),
),
} ),
@@ -2012,7 +2060,7 @@ class SubcommandsTest( TestCase ):
'filepath': TEST_JAVA },
'description': 'GoTo works for unicode identifiers' }
],
- [ 'GoTo', 'GoToDefinition', 'GoToDeclaration' ] ):
+ [ 'GoTo', 'GoToDefinition' ] ):
with self.subTest( command = command, test = test ):
RunGoToTest( app,
test[ 'description' ],
@@ -2023,6 +2071,31 @@ class SubcommandsTest( TestCase ):
has_entries( test[ 'response' ] ) )
+ @SharedYcmd
+ def test_Subcommands_GoToDeclaration( self, app ):
+ source = PathToTestFile( 'simple_eclipse_project',
+ 'src',
+ 'com',
+ 'test',
+ 'TestWidgetImpl.java' )
+ destination = PathToTestFile( 'simple_eclipse_project',
+ 'src',
+ 'com',
+ 'test',
+ 'AbstractTestWidget.java' )
+ # Seems to be the only place GoToDeclaration actually works.
+ RunGoToTest( app,
+ 'GoToDeclaration works on an override definition.',
+ source,
+ 23,
+ 17,
+ 'GoToDeclaration',
+ has_entries( {
+ 'line_num': 17,
+ 'column_num': 17,
+ 'filepath': destination } ) )
+
+
@SharedYcmd
def test_Subcommands_GoToType( self, app ):
for test in [ |
The last test failure is fixed by this commit: bstaletic@3b72abc @tonitch Feel free to cherry-pick that commit. |
change LGTM. if the tests pass then I'm happy to assume no regressions :) |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1727 +/- ##
==========================================
- Coverage 95.47% 95.44% -0.04%
==========================================
Files 83 83
Lines 8177 8159 -18
Branches 163 163
==========================================
- Hits 7807 7787 -20
- Misses 320 322 +2
Partials 50 50 |
Adding support to java 21
Fixed-By: @bstaletic Related: #1727
The GoTo subcommand might have multiple LSP handlers associated with it. Mostly, it is `textDocument/definition` and `textDocument/declaration`. Normally, we cycle through handlers until one of two things happens: 1. The handler returns more than one location. 2. The handler returns a single location, but that doese not contain the cursor. This breaks if any of the handlers throws an exception. When that happens, we immediately propagate the error, instead of trying the next handler. However, we can not simply swallow exceptions, because there's a possibility for all handlers to throw. Or some throws and some return zero locations. Current idea: 1. Do not throw as soon as a handler reports zero locations. 2. If the current handler returns more than a single location, replace previous result with the current one. 3. If there's more than one location or the single location does not contain cursor, break out of the loop - we have valid results. Otherwise, move to the next handler. 4. After exiting the handler loop, if the results are falsey, *now* throw an exception.
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 did not trust JDT with the newest code action changes, so had to execute them manually.
Things seem to be working fine.
Reviewed 2 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @tonitch)
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 all commit messages.
Reviewable status:complete! 2 of 2 LGTMs obtained (waiting on @tonitch)
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 2 of 2 files at r1, 1 of 1 files at r2.
Reviewable status:complete! 2 of 2 LGTMs obtained (waiting on @tonitch)
Thanks for sending a PR! |
Changes since the last update: ycm-core/ycmd#1728 YcmShowDetailedDiagnostic should now match what is echoed on the command line. ycm-core/ycmd#1731 Add support for `workspace/didChangeWorkspaceFolders` LSP notification. ycm-core/ycmd#1730 LSP servers are now updated with latest server state afer reset ycm-core/ycmd#1727 Update JDT to version 1.31.0 ycm-core/ycmd#1726 C# symbol search filtering fix ycm-core/ycmd#1724 C# GoToDocumentOutline consistency patch ycm-core/ycmd#1723 Implement GoToDocumentOutline in C# ycm-core/ycmd#1716 Display tsserver tags in detailed info and GetDoc `workspace/didChangeWorkspaceFolders` seems to be working fine for java, rust and go, but should be considered experimental. Definitely more field experience is needed. What it should do is allow LSP servers to understand multiple projects in the same vim instance.
Change version of jdt.ls from 1.26.0 to 1.31.0
Adding support to java 21
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)