Ale: Error with autocompletion in Rust -- E731: using Dictionary as String

Created on 6 Aug 2018  路  18Comments  路  Source: dense-analysis/ale

Information

VIM version

NVIM v0.3.1
Build type: Release

Operating System: macOS High Sierra 10.13.4 (17E202)

:ALEInfo


Current Filetype: rust
Available Linters: ['cargo', 'rls', 'rustc']
Enabled Linters: ['rls']
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'rustfmt' - Fix Rust files with Rustfmt.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:

let g:ale_rust_rls_executable = 'rls'
let g:ale_rust_rls_toolchain = 'nightly'
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 = 1
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 = 1
let g:ale_fixers = {}
let b:ale_fixers = ['rustfmt']
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 = 2000
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_lint_on_insert_leave = 0
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let b:ale_linters = ['rls']
let g:ale_linters_explicit = 0
let g:ale_list_window_size = 10
let g:ale_list_vertical = 0
let g:ale_loclist_msg_format = '%code: %%s'
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_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_warn_about_trailing_blank_lines = 0
let g:ale_warn_about_trailing_whitespace = 1
Command History:

(started) ['/bin/bash', '-c', '''rls'' +''nightly''']

What went wrong

When inserting text in insert mode, I get the following error when working on Rust files and using ALE autocompletion:
E731: using Dictionary as String

Reproducing the bug

  1. Open a rust file with let g:ale_completion_enabled = 1
  2. Start typing something that would trigger autocompletion.

I do not have this problem when working on other filetypes (tested with python). I'm using RLS on rustc 1.30.0-nightly (73c78734b 2018-08-05)

After dismissing the errors, the autocompletion pop-up is filled with appropriate completion options, as expected. Just the error that pops up and disrupts things.

bug

Most helpful comment

@davidtwco Thank you, that was what I needed to know. I pushed a commit now which should handle documentation for completion items which are sent as Dictionary values. It looks like that was the problem. We have the option of processing Markdown content in future. For now, the raw Markdown text may be displayed for messages from rls.

All 18 comments

This seems to have resolved after updating RLS, maybe it was due to a problem with today's nightly Rust and RLS

Never mind, has not resolved with latest Rust and RLS.

Are there any more lines in the error message? It would be good to know which function that error is for.

@danielwelch This doesn't happen on the stable rust toolchain, but it happens on the beta and nightly toolchains.
@w0rp Unfortunately, there is no more information in the error message.

@luxed Pardon my ignorance, but can鈥檛 RLS only be run on the nightly toolchain?

I only work with stable rust for the most part, so if there was a way to just avoid the nightly toolchain and still use rls for diagnostics/linting then I would.

Well, it could only be on the nightly when Rust stable was < 1.27 (or 1.26, I don't remember). Anyway, the fact is that, with Rust stable 1.28, an older version of the RLS is still present.

Simply run this: rustup component add rls-preview rust-analysis rust-src --toolchain stable
and then add this line to your init.vim: let g:ale_rust_rls_toolchain = 'stable'

And everything should work as intended ! (hopefully)

I can fix this if someone can tell me what line E731: using Dictionary as String is happening on.

I used to get this error, but now I'm getting E715: Dictionary Required. How would I go about getting better error messages?

For what it鈥檚 worth, since moving to the stable toolchain for RLS, this error has disappeared. I鈥檓 wondering if the problem is caused by certain nightly versions of Rust nightly that break RLS

@Deedasmi If you look at :mess, you can often see the previous error messages with the line numbers in the functions they happened it.

Sorry for the delay!

Error detected while processing function <SNR>90_VimOutputCallback[6]..<SNR>91_HandleCommandMessage[3]..ale#lsp#HandleMessage[16]..ale#lsp#HandleOtherInitializeResponses:
line   14:
E715: Dictionary required
E715: Dictionary required

That other error message is another one, and that has been fixed now. I would like to know what line the E731 error can happen on.

I don't know if it helps but the comment at line 4 in completion.vim says The omnicompletion menu is shown through a special Plug mapping which is only valid in Insert mode. This way, feedkeys() won't send these keys if you quit Insert mode quickly enough..

Yes. You'll be seeing the text there because an error was thrown somewhere else.

@w0rp I've been having this error a lot with the most recent stable RLS, in :mess there's no line numbers, but using -V20 I've managed to get the following:

continuing in function ale#completion#OmniFunc

line 23:
line 24:         return get(b:, 'ale_completion_result', [])
function ale#completion#OmniFunc returning [{'word': 'UserData', 'menu': 'pub tra...rData.html'}, 'kind': 'f', 'icase': 1}]

E731: using Dictionary as a String
E731: using Dictionary as a String

I've created a gist with all of my versions and ALEInfo output. RLS is the version currently distributed against stable with the rls-preview component in rustup.

@davidtwco Thank you, that was what I needed to know. I pushed a commit now which should handle documentation for completion items which are sent as Dictionary values. It looks like that was the problem. We have the option of processing Markdown content in future. For now, the raw Markdown text may be displayed for messages from rls.

@w0rp Excellent! I can confirm that this has fixed the issue.

Nice. :+1: Thank you for letting me know where the error is.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aressler38 picture aressler38  路  3Comments

kronos29296 picture kronos29296  路  4Comments

sublee picture sublee  路  3Comments

ilyakopy picture ilyakopy  路  4Comments

amerov picture amerov  路  4Comments