dense-analysis / dense-analysis/ale

[LSP, ccls] Deoplete source contains . and ->

Open
#2,860 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Vim Script
Stars
14k
Forks
1.5k
Avg merge
17h 49m
Merged PRs (30d)
1

Description

## Information

**VIM version**

NVIM v0.3.8
Build type: RelWithDebInfo

**Operating System:**

Fedora 30 (Thirty)

## What went wrong

`.` and `->` are wrongfully inserted:

![bug](https://user-images.githubusercontent.com/8235638/67421626-2fc63680-f5d1-11e9-8894-01a5731650ad.png)

## Reproducing the bug

Here are the steps to create a minimal Neovim config in `/tmp/vim-runtime/`

### 1. Install vim-plug and ccls

```sh
mkdir -p /tmp/vim-runtime/autoload
cd /tmp/vim-runtime

wget https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \
-O autoload/plug.vim

git clone --recurse-submodules https://github.com/MaskRay/ccls
mkdir -p ccls/build/
(cd ccls/build && cmake .. && make "-j$(nproc)")
```

### 2. Minimal init.vim to be copied to /tmp/vim-runtime/init.vim

```vim
set runtimepath=/usr/local/share/nvim/site
set runtimepath+=/usr/share/nvim/site
set runtimepath+=/usr/share/nvim/runtime
set runtimepath+=/usr/share/nvim/site/after
set runtimepath+=/usr/local/share/nvim/site/after
set runtimepath+=/tmp/vim-runtime
set completeopt-=preview

call plug#begin('/tmp/vim-runtime/plugged')

Plug 'dense-analysis/ale'
let g:ale_linters = { 'cpp': [ 'ccls' ] }
let g:ale_cpp_ccls_executable = '/tmp/vim-runtime/ccls/build/ccls'

Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
let g:deoplete#enable_at_startup = 1

call plug#end()
```

### 3. C++ code to be copied to /tmp/vim-runtime/code.cpp

```cpp
#include
#include

struct Foo {
void doNothing() {}
};

int main() {
auto foo = std::make_shared();

auto callback = [foo_ptr{std::weak_ptr{foo}}] {
if(const auto foo = foo_ptr.lock())
{
/* Complete the next line: */
foo->
}
};
}
```

### 4. Compilation database to be copied to /tmp/vim-runtime/compile_commands.json

```json
[
{
"directory": "/tmp/vim-runtime",
"command": "/usr/bin/c++ -std=gnu++17 /tmp/vim-runtime/code.cpp",
"file": "/tmp/vim-runtime/code.cpp"
}
]
```

### 5. Install ALE and deoplete

```sh
nvim -u /tmp/vim-runtime/init.vim +PlugInstall +qall
```

### 6. Start Neovim and reproduce the bug

```sh
nvim -u /tmp/vim-runtime/init.vim code.cpp
```

## :ALEInfo

```

Current Filetype: cpp
Available Linters: ['ccls', 'clang', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'flawfinder', 'gcc']
Linter Aliases:
'gcc' -> ['g++']
Enabled Linters: ['ccls']
Suggested Fixers:
'clang-format' - Fix C/C++ and cuda files with clang-format.
'clangtidy' - Fix C/C++ and ObjectiveC files with clang-tidy.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'uncrustify' - Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.
Linter Variables:

let g:ale_cpp_ccls_executable = '/tmp/vim-runtime/ccls/build/ccls'
let g:ale_cpp_ccls_init_options = {}
Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = 50
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'cpp': ['ccls']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:

(executable check - success) /tmp/vim-runtime/ccls/build/ccls
(started) ['/bin/bash', '-c', '''/tmp/vim-runtime/ccls/build/ccls''']
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.