From 7f992e92127e2d20fdda0b203d740919818536ac Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 29 Aug 2022 16:17:15 +0100 Subject: [PATCH 1/6] Update to jdt.ls 1.14.0 --- build.py | 6 +-- ycmd/tests/java/subcommands_test.py | 39 +++++++++---------- .../src/com/youcompleteme/Test.java | 1 + 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/build.py b/build.py index 66bad3e784..60c3414a8d 100755 --- a/build.py +++ b/build.py @@ -89,10 +89,10 @@ def Exit( self ): )$ """ -JDTLS_MILESTONE = '1.6.0' -JDTLS_BUILD_STAMP = '202110200520' +JDTLS_MILESTONE = '1.14.0' +JDTLS_BUILD_STAMP = '202207211651' JDTLS_SHA256 = ( - '09650af5c9dc39f0b40981bcdaa2170cbbc5bb003ac90cdb07fbb57381ac47b2' + '4978ee235049ecba9c65b180b69ef982eedd2f79dc4fd1781610f17939ecd159' ) RUST_TOOLCHAIN = 'nightly-2022-08-17' diff --git a/ycmd/tests/java/subcommands_test.py b/ycmd/tests/java/subcommands_test.py index 0481f2e928..fa023bc971 100644 --- a/ycmd/tests/java/subcommands_test.py +++ b/ycmd/tests/java/subcommands_test.py @@ -23,6 +23,7 @@ equal_to, has_entries, has_entry, + has_items, instance_of, is_not, matches_regexp ) @@ -2116,13 +2117,9 @@ def test_Subcommands_IndexOutOfRange( self, app ): 'filepath': TEST_JAVA, }, 'expect': { - 'response': requests.codes.ok, - 'data': has_entries( { 'fixits': contains_exactly( - has_entries( { 'text': 'Generate Getters and Setters', - 'chunks': instance_of( list ) } ), - has_entries( { 'text': 'Change modifiers to final where possible', - 'chunks': instance_of( list ) } ), - ) } ), + # THough, now, jdt.ls just throws an Internal error. + 'response': requests.codes.internal_server_error, + 'data': ErrorMatcher( ResponseFailedException ) } } ) @@ -2162,8 +2159,8 @@ def test_Subcommands_DifferentFileTypesUpdate( self, app ): 'description': 'Request error handles the error', 'request': { 'command': 'FixIt', - 'line_num': 99, - 'column_num': 99, + 'line_num': 27, + 'column_num': 1, 'filepath': TEST_JAVA, 'file_data': { '!/bin/sh': { @@ -2177,21 +2174,23 @@ def test_Subcommands_DifferentFileTypesUpdate( self, app ): TESTLAUNCHER_JAVA: { 'filetypes': [ 'some', 'java', 'junk', 'also' ], 'contents': ReadFile( TESTLAUNCHER_JAVA ), - }, - '!/usr/bin/sh': { - 'filetypes': [ 'java' ], - 'contents': '\n', - }, + } } }, 'expect': { 'response': requests.codes.ok, - 'data': has_entries( { 'fixits': contains_exactly( - has_entries( { 'text': 'Generate Getters and Setters', - 'chunks': instance_of( list ) } ), - has_entries( { 'text': 'Change modifiers to final where possible', - 'chunks': instance_of( list ) } ), - ) } ), + 'data': has_entries( + { + 'fixits': has_items( + has_entries( { + 'text': 'Generate Getters and Setters', + 'chunks': instance_of( list ) } ), + has_entries( { + 'text': 'Change modifiers to final where possible', + 'chunks': instance_of( list ) } ) + ) + } + ), } } ) diff --git a/ycmd/tests/java/testdata/simple_eclipse_project/src/com/youcompleteme/Test.java b/ycmd/tests/java/testdata/simple_eclipse_project/src/com/youcompleteme/Test.java index ffca520ce5..5f432b4139 100644 --- a/ycmd/tests/java/testdata/simple_eclipse_project/src/com/youcompleteme/Test.java +++ b/ycmd/tests/java/testdata/simple_eclipse_project/src/com/youcompleteme/Test.java @@ -24,3 +24,4 @@ public class TéstClass { public boolean åtest; } } + From eebd7cea7a9ff547fe7d5887c9159377fb5d478b Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 29 Aug 2022 16:55:03 +0100 Subject: [PATCH 2/6] jdt.ls requires java 17 now --- .github/workflows/ci.yml | 4 ++-- build.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab15fe156c..e85e239859 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: if: matrix.benchmark == false uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: 'adopt' - name: Install Python uses: actions/setup-python@v2 @@ -231,7 +231,7 @@ jobs: if: matrix.benchmark == false uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: 'adopt' - name: Install Python uses: actions/setup-python@v2 diff --git a/build.py b/build.py index 60c3414a8d..4f586f2864 100755 --- a/build.py +++ b/build.py @@ -1069,7 +1069,7 @@ def Print( *args, **kwargs ): sys.stdout.write( 'Installing jdt.ls for Java support...' ) sys.stdout.flush() - CheckJavaVersion( 11 ) + CheckJavaVersion( 17 ) TARGET = p.join( DIR_OF_THIRD_PARTY, 'eclipse.jdt.ls', 'target', ) REPOSITORY = p.join( TARGET, 'repository' ) From 93501d321769c133811ce4b3dedee76d6fc8f992 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 29 Aug 2022 17:53:02 +0100 Subject: [PATCH 3/6] Tidy up some logging in the tests --- ycmd/completers/completer_utils.py | 3 +-- ycmd/completers/language_server/language_server_completer.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ycmd/completers/completer_utils.py b/ycmd/completers/completer_utils.py index 6f6af161f2..ea784e4078 100644 --- a/ycmd/completers/completer_utils.py +++ b/ycmd/completers/completer_utils.py @@ -18,7 +18,7 @@ # Must not import ycm_core here! Vim imports completer, which imports this file. # We don't want ycm_core inside Vim. from collections import defaultdict -from ycmd.utils import LOGGER, ToUnicode, re, ReadFile, SplitLines +from ycmd.utils import ToUnicode, re, ReadFile, SplitLines class PreparedTriggers: @@ -227,7 +227,6 @@ def GetFileContents( request_data, filename ): try: return ToUnicode( ReadFile( filename ) ) except ( OSError, UnicodeError ): - LOGGER.warning( 'Error reading file "%s"', filename ) return '' diff --git a/ycmd/completers/language_server/language_server_completer.py b/ycmd/completers/language_server/language_server_completer.py index 99b7be124f..0788404478 100644 --- a/ycmd/completers/language_server/language_server_completer.py +++ b/ycmd/completers/language_server/language_server_completer.py @@ -2023,7 +2023,8 @@ def HandleNotificationInPollThread( self, notification ): uri = lsp.FilePathToUri( lsp.UriToFilePath( params[ 'uri' ] ) ) except lsp.InvalidUriException: # Ignore diagnostics for URIs we don't recognise - LOGGER.debug( f'Ignoring diagnostics for unrecognized URI: { uri }' ) + LOGGER.debug( + f'Ignoring diagnostics for unrecognized URI: { params[ "uri" ] }' ) return with self._latest_diagnostics_mutex: self._latest_diagnostics[ uri ] = params[ 'diagnostics' ] From 18808eae493548f37c50e1e3e0b5607b5f94093d Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 29 Aug 2022 18:47:03 +0100 Subject: [PATCH 4/6] Update regex and watchdog --- CORE_VERSION | 2 +- third_party/mrab-regex | 2 +- third_party/watchdog_deps/watchdog | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CORE_VERSION b/CORE_VERSION index ea90ee3198..9e5feb5256 100644 --- a/CORE_VERSION +++ b/CORE_VERSION @@ -1 +1 @@ -45 +46 diff --git a/third_party/mrab-regex b/third_party/mrab-regex index fa9def53cf..bf5e239c0e 160000 --- a/third_party/mrab-regex +++ b/third_party/mrab-regex @@ -1 +1 @@ -Subproject commit fa9def53cf920ed9343a0afab54d5075d4c75394 +Subproject commit bf5e239c0ed893330984d91f793dafed1d0ac9c5 diff --git a/third_party/watchdog_deps/watchdog b/third_party/watchdog_deps/watchdog index 5fbd4b689a..4cbf15c641 160000 --- a/third_party/watchdog_deps/watchdog +++ b/third_party/watchdog_deps/watchdog @@ -1 +1 @@ -Subproject commit 5fbd4b689ab86cef21834d6359969bd57f20dab0 +Subproject commit 4cbf15c6418f5d98bfe67c6132184838f7cb6ff5 From b63e889e8315fb16ad08919d410b2e5d062622c6 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 29 Aug 2022 18:47:34 +0100 Subject: [PATCH 5/6] FixUp: tests broken by overzealous checking in java tests; we can probably relax a lot of these now --- ycmd/tests/java/subcommands_test.py | 64 ++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/ycmd/tests/java/subcommands_test.py b/ycmd/tests/java/subcommands_test.py index fa023bc971..3debc17728 100644 --- a/ycmd/tests/java/subcommands_test.py +++ b/ycmd/tests/java/subcommands_test.py @@ -27,7 +27,6 @@ instance_of, is_not, matches_regexp ) -from pprint import pformat import itertools import requests import json @@ -108,8 +107,6 @@ def RunTest( app, test, contents = None ): expect_errors = True ) - print( f'completer response: { pformat( response.json ) }' ) - assert_that( response.status_code, equal_to( test[ 'expect' ][ 'response' ] ) ) @@ -117,6 +114,9 @@ def RunTest( app, test, contents = None ): break except AssertionError: if time.time() > expiry: + print( 'completer response: ' + f'{ json.dumps( response.json, indent=2 ) }' ) + raise time.sleep( 0.25 ) @@ -1089,6 +1089,10 @@ def test_Subcommands_FixIt_SingleDiag_MultipleOption_Insertion( self, app ): LocationMatcher( filepath, 25, 5 ) ), ), } ), + has_entries( { + 'kind': 'quickassist', + 'text': "Add Javadoc for 'Wimble'" + } ), ) } ) @@ -1147,6 +1151,9 @@ def test_Subcommands_FixIt_SingleDiag_SingleOption_Modify( self, app ): LocationMatcher( filepath, 25, 5 ) ), ), } ), + has_entries( { + 'text': "Add Javadoc for 'getWidget'" + } ), ) } ) @@ -1179,21 +1186,42 @@ def test_Subcommands_FixIt_SingleDiag_MultiOption_Delete( self, app ): # FixIt (and nonetheless, the previous tests ensure that we correctly # populate the chunks list; the contents all come from jdt.ls) has_entries( { - 'text': "Create getter and setter for 'testString'", + 'text': "Organize imports", 'chunks': instance_of( list ) } ), has_entries( { - 'text': "Organize imports", + 'text': "Generate Getter and Setter for 'testString'", 'chunks': instance_of( list ) } ), has_entries( { 'text': "Generate Getters and Setters", 'chunks': instance_of( list ) } ), + has_entries( { + 'text': "Generate Getters", + 'chunks': instance_of( list ) + } ), + has_entries( { + 'text': "Generate Setters", + 'chunks': instance_of( list ) + } ), + has_entries( { + 'text': "Generate Getter for 'testString'", + 'chunks': instance_of( list ) + } ), + has_entries( { + 'text': "Generate Setter for 'testString'", + 'chunks': instance_of( list ) + } ), has_entries( { 'text': 'Change modifiers to final where possible', 'chunks': instance_of( list ) } ), + has_entries( { + 'kind': 'quickassist', + 'text': "Add Javadoc for 'testString'", + 'chunks': instance_of( list ) + } ), ) } ) @@ -1272,6 +1300,10 @@ def test_Subcommands_FixIt_MultipleDiags( self, app ): 'text': 'Change modifiers to final where possible', 'chunks': instance_of( list ), } ), + has_entries( { + 'text': "Add Javadoc for 'getWidget'", + 'chunks': instance_of( list ), + } ), ] FIXITS = { @@ -1396,6 +1428,10 @@ def test_Subcommands_FixIt_Range( self, app ): 'text': 'Change modifiers to final where possible', 'chunks': instance_of( list ), } ), + has_entries( { + 'text': "Add Javadoc for 'launch'", + 'chunks': instance_of( list ), + } ), ) } ) } @@ -1460,10 +1496,19 @@ def test_Subcommands_FixIt_Unicode( self, app ): 'text': 'Change modifiers to final where possible', 'chunks': instance_of( list ), } ), + has_entries( { + 'text': "Generate Getters", + } ), + has_entries( { + 'text': "Generate Setters", + } ), has_entries( { 'text': "Generate Getters and Setters", 'chunks': instance_of( list ), } ), + has_entries( { + 'text': "Add Javadoc for 'DoWhatever'" + } ), ) } ) @@ -1525,6 +1570,9 @@ def test_Subcommands_FixIt_InvalidURI( self, app ): LocationMatcher( '', 32, 4 ) ), ), } ), + has_entries( { + 'text': "Add Javadoc for 'getWidget'" + } ), ) } ) @@ -1638,6 +1686,9 @@ def test_Subcommands_Format_WholeFile_Spaces( self, app ): ChunkMatcher( '\n ', LocationMatcher( TEST_JAVA, 24, 27 ), LocationMatcher( TEST_JAVA, 25, 3 ) ), + ChunkMatcher( '\n', + LocationMatcher( TEST_JAVA, 26, 2 ), + LocationMatcher( TEST_JAVA, 28, 1 ) ), ) } ) ) } ) @@ -1724,6 +1775,9 @@ def test_Subcommands_Format_WholeFile_Tabs( self, app ): ChunkMatcher( '\n\t', LocationMatcher( TEST_JAVA, 24, 27 ), LocationMatcher( TEST_JAVA, 25, 3 ) ), + ChunkMatcher( '\n', + LocationMatcher( TEST_JAVA, 26, 2 ), + LocationMatcher( TEST_JAVA, 28, 1 ) ), ) } ) ) } ) From 00179cf300391b6cdbb23dc7ee1eba3bc1bfd62a Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 29 Aug 2022 19:04:10 +0100 Subject: [PATCH 6/6] Seems like theres another jdtls regression that causes these to fail when run with the other tests. I'm so over jdt.ls regressions. I no longer have the patience to look into them --- ycmd/tests/java/get_completions_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ycmd/tests/java/get_completions_test.py b/ycmd/tests/java/get_completions_test.py index d645622091..0c2b2d5a7d 100644 --- a/ycmd/tests/java/get_completions_test.py +++ b/ycmd/tests/java/get_completions_test.py @@ -791,7 +791,7 @@ def test_GetCompletions_MoreThan10ForceSemantic( self, app ): @WithRetry() - @SharedYcmd + @IsolatedYcmd def test_GetCompletions_ForceAtTopLevel_NoImport( self, app ): RunTest( app, { 'description': 'When forcing semantic completion, ' @@ -845,7 +845,7 @@ def test_GetCompletions_NoForceAtTopLevel_NoImport( self, app ): @WithRetry() - @SharedYcmd + @IsolatedYcmd def test_GetCompletions_ForceAtTopLevel_WithImport( self, app ): filepath = ProjectPath( 'TestWidgetImpl.java' ) RunTest( app, {