diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | init.lua | 32 |
2 files changed, 19 insertions, 15 deletions
@@ -143,7 +143,7 @@ Available options are: * `diagnostic_styles = { error = 'back:red', warning = 'back:yellow', information = 'back:yellow', hint = 'back:yellow', }` - styles used to highlight different diagnostics * `workspace_edit_remember_cursor = true` - restore the primary cursor position after a workspaceEdit * `message_level = 3` - the level of shown messages retrieved via `window/showMessage` notifications -* `show_message = 'message'` - how to present information. `'message'`: use `vis:message`; `'open'`: use a new window supporting syntax highlighting. +* `show_message = 'message'` - how to present multiline information. `'message'`: use `vis:message`; `'open'`: use a new window supporting syntax highlighting. * `universal_root_globs = {}` - Globs to consider as workspace root for any language server (e.g. `*.git` or `*.hg`). * `fallback_dirname_as_root = false` - If set to true a file's directory is used as workspace root if no explicit root was found. * `navwin_symbols_format = '%s[%.1s] %s\n'` - The format string used to display a symbol in the symbol navigation window. @@ -454,22 +454,26 @@ end local function lspc_show_message(msg, hdr, syntax) local current_win = vis.win - if lspc.show_message == 'message' then - local to_show = (hdr or '') .. msg .. '\n' - vis:message(to_show) - vis.win.selection = vis.win.file.size - #to_show - vis:feedkeys('zt') - - elseif lspc.show_message == 'open' then - vis:command('open') - if syntax then - vis:command('set syntax ' .. syntax) - end + if string.find(string.sub(msg, 2, -2), "\n") then + if lspc.show_message == 'message' then + local to_show = (hdr or '') .. msg .. '\n' + vis:message(to_show) + vis.win.selection = vis.win.file.size - #to_show + vis:feedkeys('zt') + + elseif lspc.show_message == 'open' then + vis:command('open') + if syntax then + vis:command('set syntax ' .. syntax) + end - vis.win.file:insert(0, msg) - vis.win.selection.pos = 0 + vis.win.file:insert(0, msg) + vis.win.selection.pos = 0 + else + lspc:err('invalid message configuration "' .. lspc.show_message .. '".') + end else - lspc:err('invalid message configuration "' .. lspc.show_message .. '".') + vis:info(msg) end -- reset the focus to the current window |
