Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
H4ppy-04 authored Dec 23, 2023
2 parents ff4ce17 + 302d41e commit c28772a
Show file tree
Hide file tree
Showing 16 changed files with 175 additions and 55 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
name: "${{ matrix.runs-on }} - Python ${{ matrix.python-version }} ${{ matrix.python-arch }}"
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-arch }}
Expand All @@ -50,6 +50,7 @@ jobs:
uses: codecov/codecov-action@v3
with:
name: "${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.python-arch }}"
token: ${{ secrets.CODECOV_TOKEN }}

vim-tests:
strategy:
Expand All @@ -64,14 +65,14 @@ jobs:
YCM_TEST_STDOUT: true
name: "Vim tests - ${{ matrix.vim }}"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Install dependencies
run: sudo -H pip3 install -r python/test_requirements.txt
- name: Install Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
Expand All @@ -90,3 +91,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
name: "vim-tests-${{ matrix.vim }}"
token: ${{ secrets.CODECOV_TOKEN }}
48 changes: 40 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ The following additional language support options are available:
and add `--cs-completer` when calling `install.py`.
- Go support: install [Go][go-install] and add `--go-completer` when calling
`install.py`.
- JavaScript and TypeScript support: install [Node.js and npm][npm-install] and
- JavaScript and TypeScript support: install [Node.js 18+ and npm][npm-install] and
add `--ts-completer` when calling `install.py`.
- Rust support: add `--rust-completer` when calling `install.py`.
- Java support: install [JDK 17][jdk-install] and add
Expand Down Expand Up @@ -431,6 +431,9 @@ apt install build-essential cmake vim-nox python3-dev
- Install mono-complete, go, node, java, and npm

```
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_current.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
apt install mono-complete golang nodejs openjdk-17-jdk openjdk-17-jre npm
```

Expand Down Expand Up @@ -499,7 +502,7 @@ The following additional language support options are available:
when calling `install.py`.
- Go support: install [Go][go-install] and add `--go-completer` when calling
`install.py`.
- JavaScript and TypeScript support: install [Node.js and npm][npm-install] and
- JavaScript and TypeScript support: install [Node.js 18+ and npm][npm-install] and
add `--ts-completer` when calling `install.py`.
- Rust support: add `--rust-completer` when calling `install.py`.
- Java support: install [JDK 17][jdk-install] and add
Expand Down Expand Up @@ -613,7 +616,7 @@ The following additional language support options are available:
Be sure that [the build utility `msbuild` is in your PATH][add-msbuild-to-path].
- Go support: install [Go][go-install] and add `--go-completer` when calling
`install.py`.
- JavaScript and TypeScript support: install [Node.js and npm][npm-install] and
- JavaScript and TypeScript support: install [Node.js 18+ and npm][npm-install] and
add `--ts-completer` when calling `install.py`.
- Rust support: add `--rust-completer` when calling `install.py`.
- Java support: install [JDK 17][jdk-install] and add
Expand Down Expand Up @@ -889,7 +892,8 @@ Signature help is triggered in insert mode automatically when
`g:ycm_auto_trigger` is enabled and is not supported when it is not enabled.

The signatures popup is hidden when there are no matching signatures or when you
leave insert mode. There is no key binding to clear the popup.
leave insert mode. If you want to manually control when it is visible, you can
map something to `<plug>YCMToggleSignatureHelp` (see below).

For more details on this feature and a few demos, check out the
[PR that proposed it][signature-help-pr].
Expand Down Expand Up @@ -1110,7 +1114,7 @@ $ EXTRA_CMAKE_ARGS='-DPATH_TO_LLVM_ROOT=/path/to/your/llvm' ./install.py --clang
```

Please note that if using custom `clangd` or `libclang` it _must_ match the
version that YCM requires. Currently, YCM requires ***clang 16.0.1***.
version that YCM requires. Currently YCM requires ***clang 17.0.1***.

#### Compile flags

Expand Down Expand Up @@ -1526,8 +1530,19 @@ built YCM with the `--go-completer` flag; see the [*Installation*
section](#installation) for details). The server only works for projects with
the "canonical" layout.

`gopls` also has a handful of undocumented options for which the
[source code][gopls-preferences] is the only reference.
`gopls` also has a load of [documented options](https://github.com/golang/tools/blob/master/gopls/doc/settings.md).

You can set these in your `.ycm_extra_conf.py`. For example, to set the build tags:

```python
def Settings( **kwargs ):
if kwargs[ 'language' ] == 'go':
return {
'ls': {
'build.buildFlags': [ '-tags=debug' ] }
}
}
```

### JavaScript and TypeScript Semantic Completion

Expand All @@ -1543,7 +1558,7 @@ available on [the wiki][tern-instructions].

All JavaScript and TypeScript features are provided by the [TSServer][] engine,
which is included in the TypeScript SDK. To enable these features, install
[Node.js and npm][npm-install] and call the `install.py` script with the
[Node.js 18+ and npm][npm-install] and call the `install.py` script with the
`--ts-completer` flag.

[TSServer][] relies on [the `jsconfig.json` file][jsconfig.json] for JavaScript
Expand Down Expand Up @@ -1769,6 +1784,10 @@ You can also style the line that has the warning/error with these groups:
- `YcmWarningLine`, which falls back to group `SyntasticWarningLine` if it
exists

Finally, you can also style the popup for the detailed diagnostics (it is shown
if `g:ycm_show_detailed_diag_in_popup` is set) using the group `YcmErrorPopup`,
which falls back to `ErrorMsg`.

Note that the line highlighting groups only work when the
[`g:ycm_enable_diagnostic_signs`](#the-gycm_enable_diagnostic_signs-option)
option is set. If you want highlighted lines but no signs in the Vim gutter,
Expand Down Expand Up @@ -3715,6 +3734,19 @@ Default: `0`
let g:ycm_disable_signature_help = 1
```
### The `g:ycm_signature_help_disable_syntax` option
Set this to 1 to disable syntax highlighting in the signature help popup. Thiis
can help if your colourscheme doesn't work well with the default highliting and
inverse video.
Default: `0`
```viml
" Disable signature help syntax highliting
let g:ycm_signature_help_disable_syntax = 1
```
### The `g:ycm_gopls_binary_path` option
In case the system-wide `gopls` binary is newer than the bundled one, setting
Expand Down
4 changes: 4 additions & 0 deletions autoload/youcompleteme.vim
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ function! s:SetUpSyntaxHighlighting()
\ 'combine': 0,
\ 'override': 1 } )
endif

if !hlexists( 'YcmErrorPopup' )
highlight default link YcmErrorPopup ErrorMsg
endif
endfunction


Expand Down
63 changes: 47 additions & 16 deletions doc/youcompleteme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,14 @@ Contents ~
56. The |g:ycm_clangd_uses_ycmd_caching| option
57. The |g:ycm_language_server| option
58. The |g:ycm_disable_signature_help| option
59. The |g:ycm_gopls_binary_path| option
60. The |g:ycm_gopls_args| option
61. The |g:ycm_rls_binary_path| and 'g:ycm_rustc_binary_path' options
62. The |g:ycm_rust_toolchain_root| option
63. The |g:ycm_tsserver_binary_path| option
64. The |g:ycm_roslyn_binary_path| option
65. The |g:ycm_update_diagnostics_in_insert_mode| option
59. The |g:ycm_signature_help_disable_syntax| option
60. The |g:ycm_gopls_binary_path| option
61. The |g:ycm_gopls_args| option
62. The |g:ycm_rls_binary_path| and 'g:ycm_rustc_binary_path' options
63. The |g:ycm_rust_toolchain_root| option
64. The |g:ycm_tsserver_binary_path| option
65. The |g:ycm_roslyn_binary_path| option
66. The |g:ycm_update_diagnostics_in_insert_mode| option
12. FAQ |youcompleteme-faq|
13. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
14. Contact |youcompleteme-contact|
Expand Down Expand Up @@ -609,7 +610,7 @@ The following additional language support options are available:
- Go support: install Go [31] and add '--go-completer' when calling
'install.py'.

- JavaScript and TypeScript support: install Node.js and npm [32] and add
- JavaScript and TypeScript support: install Node.js 18+ and npm [32] and add
'--ts-completer' when calling 'install.py'.

- Rust support: add '--rust-completer' when calling 'install.py'.
Expand Down Expand Up @@ -649,6 +650,9 @@ Quick start, installing all completers ~
<
- Install mono-complete, go, node, java and npm
>
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_current.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
apt install mono-complete golang nodejs openjdk-17-jdk openjdk-17-jre npm
<
- Compile YCM
Expand Down Expand Up @@ -708,7 +712,7 @@ The following additional language support options are available:
- Go support: install Go [31] and add '--go-completer' when calling
'install.py'.

- JavaScript and TypeScript support: install Node.js and npm [32] and add
- JavaScript and TypeScript support: install Node.js 18+ and npm [32] and add
'--ts-completer' when calling 'install.py'.

- Rust support: add '--rust-completer' when calling 'install.py'.
Expand Down Expand Up @@ -818,7 +822,7 @@ The following additional language support options are available:
- Go support: install Go [31] and add '--go-completer' when calling
'install.py'.

- JavaScript and TypeScript support: install Node.js and npm [32] and add
- JavaScript and TypeScript support: install Node.js 18+ and npm [32] and add
'--ts-completer' when calling 'install.py'.

- Rust support: add '--rust-completer' when calling 'install.py'.
Expand Down Expand Up @@ -1095,7 +1099,8 @@ Signature help is triggered in insert mode automatically when
|g:ycm_auto_trigger| is enabled and is not supported when it is not enabled.

The signatures popup is hidden when there are no matching signatures or when
you leave insert mode. There is no key binding to clear the popup.
you leave insert mode. If you want to manually control when it is visible, you
can map something to '<plug>YCMToggleSignatureHelp' (see below).

For more details on this feature and a few demos, check out the PR that
proposed it [45].
Expand Down Expand Up @@ -1331,7 +1336,7 @@ build or acquire 'libclang' for yourself and specify it when building, as:
$ EXTRA_CMAKE_ARGS='-DPATH_TO_LLVM_ROOT=/path/to/your/llvm' ./install.py --clang-completer --system-libclang
<
Please note that if using custom 'clangd' or 'libclang' it _must_ match the
version that YCM requires. Currently YCM requires **_clang 16.0.1_**.
version that YCM requires. Currently YCM requires **_clang 17.0.1_**.

-------------------------------------------------------------------------------
*youcompleteme-compile-flags*
Expand Down Expand Up @@ -1754,9 +1759,19 @@ Completions and GoTo commands should work out of the box (provided that you
built YCM with the '--go-completer' flag; see the _Installation_ section for
details). The server only works for projects with the "canonical" layout.

'gopls' also has a handful of undocumented options for which the source code
[72] is the only reference.
'gopls' also has a load of documented options [72].

You can set these in your '.ycm_extra_conf.py'. For example, to set the build
tags:
>
def Settings( **kwargs ):
if kwargs[ 'language' ] == 'go':
return {
'ls': {
'build.buildFlags': [ '-tags=debug' ] }
}
}
<
-------------------------------------------------------------------------------
*youcompleteme-javascript-typescript-semantic-completion*
JavaScript and TypeScript Semantic Completion ~
Expand All @@ -1773,7 +1788,7 @@ available on the wiki [74].

All JavaScript and TypeScript features are provided by the TSServer [15]
engine, which is included in the TypeScript SDK. To enable these features,
install Node.js and npm [32] and call the 'install.py' script with the
install Node.js 18+ and npm [32] and call the 'install.py' script with the
'--ts-completer' flag.

TSServer [15] relies on the 'jsconfig.json' file [75] for JavaScript and the
Expand Down Expand Up @@ -2015,6 +2030,10 @@ You can also style the line that has the warning/error with these groups:
- 'YcmWarningLine', which falls back to group 'SyntasticWarningLine' if it
exists

Finally, you can also style the popup for the detailed diagnostics (it is shown
if |g:ycm_show_detailed_diag_in_popup| is set) using the group 'YcmErrorPopup',
which falls back to 'ErrorMsg'.

Note that the line highlighting groups only work when the
|g:ycm_enable_diagnostic_signs| option is set. If you want highlighted lines
but no signs in the Vim gutter, set the 'signcolumn' option to 'no' in your
Expand Down Expand Up @@ -3927,6 +3946,18 @@ Default: '0'
let g:ycm_disable_signature_help = 1
<
-------------------------------------------------------------------------------
The *g:ycm_signature_help_disable_syntax* option

Set this to 1 to disable syntax highlighting in the signature help popup. Thiis
can help if your colourscheme doesn't work well with the default highliting and
inverse video.

Default: '0'
>
" Disable signature help syntax highliting
let g:ycm_signature_help_disable_syntax = 1
<
-------------------------------------------------------------------------------
The *g:ycm_gopls_binary_path* option

In case the system-wide 'gopls' binary is newer than the bundled one, setting
Expand Down Expand Up @@ -4122,7 +4153,7 @@ References ~
[69] https://github.com/rust-lang/rls
[70] https://www.rust-lang.org/downloads.html
[71] https://rust-analyzer.github.io/manual.html#configuration]
[72] https://github.com/golang/tools/blob/master/internal/lsp/server.go
[72] https://github.com/golang/tools/blob/master/gopls/doc/settings.md
[73] https://ternjs.net
[74] https://github.com/ycm-core/YouCompleteMe/wiki/JavaScript-Semantic-Completion-through-Tern
[75] https://code.visualstudio.com/docs/languages/jsconfig
Expand Down
3 changes: 1 addition & 2 deletions python/ycm/diagnostic_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def OnCursorMoved( self ):
if self._user_options[ 'echo_current_diagnostic' ]:
line, _ = vimsupport.CurrentLineAndColumn()
line += 1 # Convert to 1-based
if ( not self.ShouldUpdateDiagnosticsUINow() and
self._diag_message_needs_clearing ):
if not self.ShouldUpdateDiagnosticsUINow():
# Clear any previously echo'd diagnostic in insert mode
self._EchoDiagnosticText( line, None, None )
elif line != self._previous_diag_line_number:
Expand Down
7 changes: 7 additions & 0 deletions python/ycm/scrolling_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ def Request( self, force=False ):
# - look up the actual visible range, then call this function
# - if not overlapping, do the factor expansion and request
self._last_requested_range = vimsupport.RangeVisibleInBuffer( self._bufnr )
# If this is false, either the self._bufnr is not a valid buffer number or
# the buffer is not visible in any window.
# Since this is called asynchronously, a user may bwipeout a buffer with
# self._bufnr number between polls.
if self._last_requested_range is None:
return False

self._tick = vimsupport.GetBufferChangedTick( self._bufnr )

# We'll never use the last response again, so clear it
Expand Down
6 changes: 5 additions & 1 deletion python/ycm/signature_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ def UpdateSignatureHelp( state, signature_info ): # noqa
if state.state == SignatureHelpState.ACTIVE:
vim.eval( f'popup_show( { state.popup_win_id } )' )

syntax = utils.ToUnicode( vim.current.buffer.options[ 'syntax' ] )
if vim.vars.get( 'ycm_signature_help_disable_syntax', False ):
syntax = ''
else:
syntax = utils.ToUnicode( vim.current.buffer.options[ 'syntax' ] )

active_signature = int( signature_info.get( 'activeSignature', 0 ) )
vim.eval( f"win_execute( { state.popup_win_id }, "
f"'set syntax={ syntax } cursorline | "
Expand Down
6 changes: 5 additions & 1 deletion python/ycm/vimsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ class Range:
start: Location = Location()
end: Location = Location()

buffer = vim.buffers[ bufnr ]
try:
buffer = vim.buffers[ bufnr ]
except KeyError:
return None

if not windows:
return None
Expand Down Expand Up @@ -751,6 +754,7 @@ def PostVimMessage( message, warning = True, truncate = False ):
vim_width = GetIntValue( '&columns' )

message = message.replace( '\n', ' ' )
message = message.replace( '\t', ' ' )
if len( message ) >= vim_width:
message = message[ : vim_width - 4 ] + '...'

Expand Down
6 changes: 4 additions & 2 deletions python/ycm/youcompleteme.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,10 @@ def OnInsertEnter( self ):


def OnInsertLeave( self ):
async_diags = any( self._message_poll_requests.get( filetype )
for filetype in vimsupport.CurrentFiletypes() )
if ( not self._user_options[ 'update_diagnostics_in_insert_mode' ] and
not self.CurrentBuffer().ParseRequestPending() ):
( async_diags or not self.CurrentBuffer().ParseRequestPending() ) ):
self.CurrentBuffer().RefreshDiagnosticsUI()
SendEventNotificationAsync( 'InsertLeave' )

Expand Down Expand Up @@ -849,7 +851,7 @@ def ShowDetailedDiagnostic( self, message_in_popup ):
'maxwidth': available_columns,
'close': 'click',
'fixed': 0,
'highlight': 'ErrorMsg',
'highlight': 'YcmErrorPopup',
'border': [ 1, 1, 1, 1 ],
# Close when moving cursor
'moved': 'expr',
Expand Down
Loading

0 comments on commit c28772a

Please sign in to comment.