Skip to content

Commit

Permalink
Merge pull request #4205 from dkaszews/readme-net6
Browse files Browse the repository at this point in the history
Add instructions for use with .NET 6.0
  • Loading branch information
mergify[bot] committed Dec 28, 2023
2 parents 302d41e + 79e3753 commit ae07211
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 14 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -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 <project1.csproj> <project2.csproj> ...`
for all of your projects
1. Run `:YcmRestartServer`

### Python Semantic Completion

YCM relies on the [Jedi][] engine to provide completion and code navigation. By
Expand Down
5 changes: 5 additions & 0 deletions python/ycm/semantic_highlighting.py
Expand Up @@ -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()

Expand Down
32 changes: 19 additions & 13 deletions test/diagnostics.test.vim
Expand Up @@ -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\<CR>", funcref( 'CheckNoPropsAfterNewLine' )
call FeedAndCheckAgain( "A\<CR>", funcref( 'CheckNoPropsAfterNewLine' ) )
endfunction

function! CheckNoPropsAfterNewLine( id ) closure
Expand All @@ -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(',
Expand All @@ -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.
Expand All @@ -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' ] ) ) } )
Expand Down Expand Up @@ -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!
Expand All @@ -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()
Expand All @@ -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, '$' ) )

Expand Down Expand Up @@ -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()
Expand All @@ -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(
Expand Down
18 changes: 18 additions & 0 deletions test/lib/autoload/youcompleteme/test/popup.vim
Expand Up @@ -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

0 comments on commit ae07211

Please sign in to comment.