From 07e3ae94c3ccf3103a859f2321de4d4a2a64ac49 Mon Sep 17 00:00:00 2001 From: Dominik Kaszewski Date: Sun, 10 Dec 2023 21:01:54 +0100 Subject: [PATCH 1/3] Add instructions for use with .NET 6.0 --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 356b2298d8..76e2114594 100644 --- a/README.md +++ b/README.md @@ -1393,6 +1393,21 @@ def CSharpSolutionFile( filepath ): If the path returned by `CSharpSolutionFile` is not an actual file, YCM will fall back to the other way of finding the file. +#### Use with .NET 6.0 and .NET SDKs + +YCM ships with older version of OmniSharp-Roslyn based on Mono runtime. +It is possible to use it with .NET 6.0 and newer, but it requires manual setup. + +1. Download NET 6.0 version of the OmniSharp server for your system from +[releases](https://github.com/OmniSharp/omnisharp-roslyn/releases/) +1. Set `g:ycm_roslyn_binary_path` to the unpacked executable `OmniSharp` +1. Create a solution file if one doesn't already exist, it is currently required +by YCM for internal bookkeeping + 1. Run `dotnet new sln` at the root of your project + 1. Run `dotnet sln add ...` + for all of your projects +1. Run `:YcmRestartServer` + ### Python Semantic Completion YCM relies on the [Jedi][] engine to provide completion and code navigation. By From a0d670d1209b5a922a3b83c59edc89d46a3f5635 Mon Sep 17 00:00:00 2001 From: Dominik Kaszewski Date: Wed, 27 Dec 2023 20:35:30 +0100 Subject: [PATCH 2/3] Update ycmd to fix g:ycm_roslyn_binary_path --- third_party/ycmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/ycmd b/third_party/ycmd index e755af6fd4..80a034d64f 160000 --- a/third_party/ycmd +++ b/third_party/ycmd @@ -1 +1 @@ -Subproject commit e755af6fd45f1a7be33420258566cc586d03898a +Subproject commit 80a034d64f37f20f02a98681e11eb38cda5ef559 From 79e3753020d9785a8c56a17f79df40828f53cda1 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 28 Dec 2023 09:58:49 +0000 Subject: [PATCH 3/3] Fix Vim tests Broken by ycm-core/ycmd#1720 - Add diagnostic type to output Inexplicable syntax errors Missing semantic_highlighting groups lead to unexpected output Improve diagnostic test failure messages - print the popup positions --- python/ycm/semantic_highlighting.py | 5 +++ test/diagnostics.test.vim | 32 +++++++++++-------- .../lib/autoload/youcompleteme/test/popup.vim | 18 +++++++++++ 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/python/ycm/semantic_highlighting.py b/python/ycm/semantic_highlighting.py index b6f48d0273..d462d304ed 100644 --- a/python/ycm/semantic_highlighting.py +++ b/python/ycm/semantic_highlighting.py @@ -51,6 +51,11 @@ 'regexp': 'String', 'operator': 'Operator', 'unknown': 'Normal', + + # These are not part of the spec, but are used by clangd + 'bracket': 'Normal', + # These are not part of the spec, but are used by jdt.ls + 'annotation': 'Macro', } REPORTED_MISSING_TYPES = set() diff --git a/test/diagnostics.test.vim b/test/diagnostics.test.vim index b8a60f9ed5..3c39f5d1a3 100644 --- a/test/diagnostics.test.vim +++ b/test/diagnostics.test.vim @@ -90,7 +90,7 @@ function! Test_Disable_Diagnostics_Update_In_insert_Mode() call WaitForAssert( {-> assert_true( len( sign_getplaced( \ '%', \ { 'group': 'ycm_signs' } )[ 0 ][ 'signs' ] ) ) } ) - call FeedAndCheckAgain( "A\", funcref( 'CheckNoPropsAfterNewLine' ) + call FeedAndCheckAgain( "A\", funcref( 'CheckNoPropsAfterNewLine' ) ) endfunction function! CheckNoPropsAfterNewLine( id ) closure @@ -103,7 +103,7 @@ function! Test_Disable_Diagnostics_Update_In_insert_Mode() \ 1, { 'end_lnum': -1, \ 'types': [ 'YcmVirtDiagWarning', \ 'YcmVirtDiagError', - \ 'YcmVirtDiagPadding' ] } ) ) ) ) + \ 'YcmVirtDiagPadding' ] } ) ) ) } ) endfunction call FeedAndCheckMain( 'imain(', @@ -121,14 +121,14 @@ function! Test_Changing_Filetype_Refreshes_Diagnostics() \ '/test/testdata/diagnostics/foo.xml', \ { 'native_ft': 0 } ) - call assert_equal( 'xml', &ft ) + call assert_equal( 'xml', &filetype ) call assert_false( \ pyxeval( 'ycm_state._buffers[' . bufnr( '%' ) . ']._async_diags' ) ) call assert_true( empty( sign_getplaced( \ '%', \ { 'group': 'ycm_signs' } )[ 0 ][ 'signs' ] ) ) setf typescript - call assert_equal( 'typescript', &ft ) + call assert_equal( 'typescript', &filetype ) call assert_false( \ pyxeval( 'ycm_state._buffers[' . bufnr( '%' ) . ']._async_diags' ) ) " Diagnostics are async, so wait for the assert to return 0 for a while. @@ -151,7 +151,7 @@ function! Test_MessagePoll_After_LocationList() \ '/test/testdata/diagnostics/foo.cpp', {} ) setf cpp - call assert_equal( 'cpp', &ft ) + call assert_equal( 'cpp', &filetype ) call WaitForAssert( {-> assert_equal( 2, len( sign_getplaced( \ '%', \ { 'group': 'ycm_signs' } )[ 0 ][ 'signs' ] ) ) } ) @@ -251,7 +251,7 @@ function! Test_ShowDetailedDiagnostic_CmdLine() call assert_equal( \ "Format specifies type 'char *' but the argument has type 'int' " - \ . '(fix available)', + \ . '(fix available) [-Wformat]', \ trim( output ) ) %bwipe! @@ -264,8 +264,11 @@ function! Test_ShowDetailedDiagnostic_PopupAtCursor() call cursor( [ 3, 1 ] ) YcmShowDetailedDiagnostic popup - let id = popup_locate( 4, 1 ) - call assert_notequal( 0, id, "Couldn't find popup!" ) + let id = popup_locate( 4, 16 ) + call assert_notequal( + \ 0, + \ id, + \ "Couldn't find popup! " .. youcompleteme#test#popup#DumpPopups() ) if exists( '*popup_list' ) let popups = popup_list() @@ -274,13 +277,13 @@ function! Test_ShowDetailedDiagnostic_PopupAtCursor() call youcompleteme#test#popup#CheckPopupPosition( id, { \ 'visible': 1, - \ 'col': 1, + \ 'col': 16, \ 'line': 4, \ } ) call assert_equal( \ [ \ "Format specifies type 'char *' but the argument has type 'int' " - \ . '(fix available)', + \ . '(fix available) [-Wformat]', \ ], \ getbufline( winbufnr(id), 1, '$' ) ) @@ -315,8 +318,11 @@ function! Test_ShowDetailedDiagnostic_Popup_WithCharacters() call cursor( [ 4, 1 ] ) YcmShowDetailedDiagnostic popup - let id = popup_locate( 5, 1 ) - call assert_notequal( 0, id, "Couldn't find popup!" ) + let id = popup_locate( 5, 7 ) + call assert_notequal( + \ 0, + \ id, + \ "Couldn't find popup! " .. youcompleteme#test#popup#DumpPopups() ) if exists( '*popup_list' ) let popups = popup_list() @@ -325,7 +331,7 @@ function! Test_ShowDetailedDiagnostic_Popup_WithCharacters() call youcompleteme#test#popup#CheckPopupPosition( id, { \ 'visible': 1, - \ 'col': 1, + \ 'col': 7, \ 'line': 5, \ } ) call assert_match( diff --git a/test/lib/autoload/youcompleteme/test/popup.vim b/test/lib/autoload/youcompleteme/test/popup.vim index b7873c4dc1..f05c8c7d43 100644 --- a/test/lib/autoload/youcompleteme/test/popup.vim +++ b/test/lib/autoload/youcompleteme/test/popup.vim @@ -40,3 +40,21 @@ function! youcompleteme#test#popup#ScreenPos( winid, row, col ) let [ w_row, w_col ] = win_screenpos( a:winid ) return { 'row': w_row + a:row, 'col': w_col + a:col } endfunction + + +function! youcompleteme#test#popup#DumpPopups() abort + if !exists( 'popup_list' ) + " Old vim.. + return '' + endif + + let output = 'Popups:' + for winid in popup_list() + let output .= ' [' + \ . string( winid ) + \ . '@' + \ . string( popup_getpos( winid ) ) + \ . ']' + endfor + return output +endfunction