aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/nvim.13
-rw-r--r--runtime/doc/autocmd.txt2
-rw-r--r--runtime/doc/eval.txt13
-rw-r--r--runtime/doc/helphelp.txt4
-rw-r--r--runtime/doc/map.txt5
-rw-r--r--runtime/doc/usr_20.txt2
-rw-r--r--runtime/doc/visual.txt3
-rw-r--r--runtime/ftplugin/indent.vim7
-rw-r--r--runtime/ftplugin/vb.vim82
-rw-r--r--runtime/lua/vim/diagnostic.lua35
-rw-r--r--runtime/lua/vim/lsp.lua16
-rw-r--r--runtime/lua/vim/lsp/buf.lua14
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim180
-rw-r--r--runtime/syntax/indent.vim9
-rw-r--r--test/functional/lua/diagnostic_spec.lua13
15 files changed, 234 insertions, 154 deletions
diff --git a/man/nvim.1 b/man/nvim.1
index b206b62343..43dfc21dc7 100644
--- a/man/nvim.1
+++ b/man/nvim.1
@@ -177,8 +177,7 @@ If
.Ar vimrc
is
.Cm NORC ,
-do not load any initialization files (except plugins),
-and do not attempt to parse environment variables.
+do not load any initialization files (except plugins).
If
.Ar vimrc
is
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 2737ac9b9f..7ca6b3cd8e 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -57,7 +57,7 @@ The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
See |autocmd-buflocal|.
Note: The ":autocmd" command can only be followed by another command when the
-'|' appears before {cmd}. This works: >
+'|' appears where the pattern is expected. This works: >
:augroup mine | au! BufRead | augroup END
But this sees "augroup" as part of the defined command: >
:augroup mine | au! BufRead * | augroup END
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 58d5d30146..02ff9fc591 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5136,8 +5136,8 @@ getline({lnum} [, {end}])
digit, |line()| is called to translate the String into a Number.
To get the line under the cursor: >
getline(".")
-< When {lnum} is smaller than 1 or bigger than the number of
- lines in the buffer, an empty string is returned.
+< When {lnum} is a number smaller than 1 or bigger than the
+ number of lines in the buffer, an empty string is returned.
When {end} is given the result is a |List| where each item is
a line from the current buffer in the range {lnum} to {end},
@@ -7464,15 +7464,18 @@ printf({fmt}, {expr1} ...) *printf()*
field width. If the converted value has fewer bytes
than the field width, it will be padded with spaces on
the left (or right, if the left-adjustment flag has
- been given) to fill out the field width.
+ been given) to fill out the field width. For the S
+ conversion the count is in cells.
.precision
An optional precision, in the form of a period '.'
followed by an optional digit string. If the digit
string is omitted, the precision is taken as zero.
This gives the minimum number of digits to appear for
- d, o, x, and X conversions, or the maximum number of
- bytes to be printed from a string for s conversions.
+ d, o, x, and X conversions, the maximum number of
+ bytes to be printed from a string for s conversions,
+ or the maximum number of cells to be printed from a
+ string for S conversions.
For floating point it is the number of digits after
the decimal point.
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index c884eea54f..e7b489d6e1 100644
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -319,7 +319,7 @@ Hints for translators:
3. Writing help files *help-writing*
For ease of use, a Vim help file for a plugin should follow the format of the
-standard Vim help files, except fot the fist line. If you are writing a new
+standard Vim help files, except for the first line. If you are writing a new
help file it's best to copy one of the existing files and use it as a
template.
@@ -332,7 +332,7 @@ remainder of the line, after a Tab, describes the plugin purpose in a short
way. This will show up in the "LOCAL ADDITIONS" section of the main help
file. Check there that it shows up properly: |local-additions|.
-If you want to add a version number of last modification date, put it in the
+If you want to add a version number or last modification date, put it in the
second line, right aligned.
At the bottom of the help file, place a Vim modeline to set the 'textwidth'
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 0b9ac42898..0ea2565694 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -81,6 +81,9 @@ modes.
Remove the mapping of {lhs} for the modes where the
map command applies. The mapping may remain defined
for other modes where it applies.
+ It also works when {lhs} matches the {rhs} of a
+ mapping. This is for when when an abbreviation
+ applied.
Note: Trailing spaces are included in the {lhs}. This
unmap does NOT work: >
:map @@ foo
@@ -320,6 +323,8 @@ Note:
- For the same reason, |keycodes| like <C-R><C-W> are interpreted as plain,
unmapped keys.
- The command is not echo'ed, no need for <silent>.
+- The {rhs} is not subject to abbreviations nor to other mappings, even if the
+ mapping is recursive.
- In Visual mode you can use `line('v')` and `col('v')` to get one end of the
Visual area, the cursor is at the other end.
- In select-mode, |:map| and |:vmap| command mappings are executed in
diff --git a/runtime/doc/usr_20.txt b/runtime/doc/usr_20.txt
index cff5c7d2f2..6a8836c8e8 100644
--- a/runtime/doc/usr_20.txt
+++ b/runtime/doc/usr_20.txt
@@ -292,7 +292,7 @@ to newer commands.
There are actually five histories. The ones we will mention here are for ":"
commands and for "/" and "?" search commands. The "/" and "?" commands share
the same history, because they are both search commands. The three other
-histories are for expressions, debug more commands and input lines for the
+histories are for expressions, debug mode commands and input lines for the
input() function. |cmdline-history|
Suppose you have done a ":set" command, typed ten more colon commands and then
diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt
index 111588e43a..4a69fc989b 100644
--- a/runtime/doc/visual.txt
+++ b/runtime/doc/visual.txt
@@ -360,7 +360,8 @@ same amount of text as the last time:
last line the same number of characters as in the last line the last time.
The start of the text is the Cursor position. If the "$" command was used as
one of the last commands to extend the highlighted text, the repeating will
-be applied up to the rightmost column of the longest line.
+be applied up to the rightmost column of the longest line. Any count passed
+to the `.` command is not used.
==============================================================================
diff --git a/runtime/ftplugin/indent.vim b/runtime/ftplugin/indent.vim
index e6d928a073..64a650ad7b 100644
--- a/runtime/ftplugin/indent.vim
+++ b/runtime/ftplugin/indent.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
-" Language: indent(1) configuration file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2008-07-09
+" Language: indent(1) configuration file
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2008-07-09
if exists("b:did_ftplugin")
finish
diff --git a/runtime/ftplugin/vb.vim b/runtime/ftplugin/vb.vim
index d70db89273..5a9548115b 100644
--- a/runtime/ftplugin/vb.vim
+++ b/runtime/ftplugin/vb.vim
@@ -1,44 +1,70 @@
" Vim filetype plugin file
-" Language: VisualBasic (ft=vb)
-" Maintainer: Johannes Zellner <johannes@zellner.org>
-" Last Change: Thu, 22 Nov 2001 12:56:14 W. Europe Standard Time
+" Language: Visual Basic (ft=vb)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
+" Last Change: 2021 Nov 17
-if exists("b:did_ftplugin") | finish | endif
+if exists("b:did_ftplugin")
+ finish
+endif
let b:did_ftplugin = 1
-setlocal com=sr:'\ -,mb:'\ \ ,el:'\ \ ,:'
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal comments=sr:'\ -,mb:'\ \ ,el:'\ \ ,:'
+setlocal commentstring='\ %s
+setlocal formatoptions-=t formatoptions+=croql
+
+let b:undo_ftplugin = "setlocal com< cms< fo<"
" we need this wrapper, as call doesn't allow a count
-fun! <SID>VbSearch(pattern, flags)
+function! s:VbSearch(pattern, flags)
let cnt = v:count1
while cnt > 0
call search(a:pattern, a:flags)
let cnt = cnt - 1
endwhile
-endfun
+endfunction
-let s:cpo_save = &cpo
-set cpo&vim
+if !exists("no_plugin_maps") && !exists("no_vb_maps")
+ nnoremap <buffer> <silent> [[ <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sbW')<CR>
+ vnoremap <buffer> <silent> [[ <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sbW')<CR>
+ nnoremap <buffer> <silent> ]] <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sW')<CR>
+ vnoremap <buffer> <silent> ]] <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sW')<CR>
+ nnoremap <buffer> <silent> [] <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sbW')<CR>
+ vnoremap <buffer> <silent> [] <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sbW')<CR>
+ nnoremap <buffer> <silent> ][ <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sW')<CR>
+ vnoremap <buffer> <silent> ][ <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sW')<CR>
+ let b:undo_ftplugin .= " | sil! exe 'nunmap <buffer> [[' | sil! exe 'vunmap <buffer> [['" .
+ \ " | sil! exe 'nunmap <buffer> ]]' | sil! exe 'vunmap <buffer> ]]'" .
+ \ " | sil! exe 'nunmap <buffer> []' | sil! exe 'vunmap <buffer> []'" .
+ \ " | sil! exe 'nunmap <buffer> ][' | sil! exe 'vunmap <buffer> ]['"
+endif
+
+" TODO: line start anchors are almost certainly overly restrictive - allow
+" after statement separators. Even in QuickBasic only block IF statements
+" were required to be at the start of a line.
+if exists("loaded_matchit") && !exists("b:match_words")
+ let b:match_ignorecase = 1
+ let b:match_words =
+ \ '\%(^\s*\)\@<=\<if\>.*\<then\>\s*\%($\|''\):\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<elseif\>:\%(^\s*\)\@<=\<end\>\s\+\<if\>,' .
+ \ '\%(^\s*\)\@<=\<for\>:\%(^\s*\)\@<=\<next\>,' .
+ \ '\%(^\s*\)\@<=\<while\>:\%(^\s*\)\@<=\<wend\>,' .
+ \ '\%(^\s*\)\@<=\<do\>:\%(^\s*\)\@<=\<loop\>\s\+\<while\>,' .
+ \ '\%(^\s*\)\@<=\<select\>\s\+\<case\>:\%(^\s*\)\@<=\<case\>:\%(^\s*\)\@<=\<end\>\s\+\<select\>,' .
+ \ '\%(^\s*\)\@<=\<enum\>:\%(^\s*\)\@<=\<end\>\s\<enum\>,' .
+ \ '\%(^\s*\)\@<=\<with\>:\%(^\s*\)\@<=\<end\>\s\<with\>,' .
+ \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<function\>\s\+\([^ \t(]\+\):\%(^\s*\)\@<=\<\1\>\s*=:\%(^\s*\)\@<=\<end\>\s\+\<function\>,' .
+ \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<sub\>\s\+:\%(^\s*\)\@<=\<end\>\s\+\<sub\>'
+ let b:undo_ftplugin .= " | unlet! b:match_words b:match_ignorecase"
+endif
-" NOTE the double escaping \\|
-nnoremap <buffer> <silent> [[ :call <SID>VbSearch('^\s*\(\(private\|public\)\s\+\)\=\(function\\|sub\)', 'bW')<cr>
-nnoremap <buffer> <silent> ]] :call <SID>VbSearch('^\s*\(\(private\|public\)\s\+\)\=\(function\\|sub\)', 'W')<cr>
-nnoremap <buffer> <silent> [] :call <SID>VbSearch('^\s*\<end\>\s\+\(function\\|sub\)', 'bW')<cr>
-nnoremap <buffer> <silent> ][ :call <SID>VbSearch('^\s*\<end\>\s\+\(function\\|sub\)', 'W')<cr>
-
-" matchit support
-if exists("loaded_matchit")
- let b:match_ignorecase=1
- let b:match_words=
- \ '\%(^\s*\)\@<=\<if\>.*\<then\>\s*$:\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<elseif\>:\%(^\s*\)\@<=\<end\>\s\+\<if\>,' .
- \ '\%(^\s*\)\@<=\<for\>:\%(^\s*\)\@<=\<next\>,' .
- \ '\%(^\s*\)\@<=\<while\>:\%(^\s*\)\@<=\<wend\>,' .
- \ '\%(^\s*\)\@<=\<do\>:\%(^\s*\)\@<=\<loop\>\s\+\<while\>,' .
- \ '\%(^\s*\)\@<=\<select\>\s\+\<case\>:\%(^\s*\)\@<=\<case\>:\%(^\s*\)\@<=\<end\>\s\+\<select\>,' .
- \ '\%(^\s*\)\@<=\<enum\>:\%(^\s*\)\@<=\<end\>\s\<enum\>,' .
- \ '\%(^\s*\)\@<=\<with\>:\%(^\s*\)\@<=\<end\>\s\<with\>,' .
- \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<function\>\s\+\([^ \t(]\+\):\%(^\s*\)\@<=\<\1\>\s*=:\%(^\s*\)\@<=\<end\>\s\+\<function\>,' .
- \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<sub\>\s\+:\%(^\s*\)\@<=\<end\>\s\+\<sub\>'
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Visual Basic Source Files (*.bas)\t*.bas\n" .
+ \ "Visual Basic Form Files (*.frm)\t*.frm\n" .
+ \ "All Files (*.*)\t*.*\n"
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
let &cpo = s:cpo_save
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 9b57467a52..74996faf3c 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -39,39 +39,22 @@ M.handlers = setmetatable({}, {
-- Metatable that automatically creates an empty table when assigning to a missing key
local bufnr_and_namespace_cacher_mt = {
__index = function(t, bufnr)
- if not bufnr or bufnr == 0 then
- bufnr = vim.api.nvim_get_current_buf()
- end
-
- rawset(t, bufnr, {})
-
- return rawget(t, bufnr)
- end,
-
- __newindex = function(t, bufnr, v)
- if not bufnr or bufnr == 0 then
- bufnr = vim.api.nvim_get_current_buf()
- end
-
- rawset(t, bufnr, v)
+ assert(bufnr > 0, "Invalid buffer number")
+ t[bufnr] = {}
+ return t[bufnr]
end,
}
local diagnostic_cache = setmetatable({}, {
__index = function(t, bufnr)
- if not bufnr or bufnr == 0 then
- bufnr = vim.api.nvim_get_current_buf()
- end
-
+ assert(bufnr > 0, "Invalid buffer number")
vim.api.nvim_buf_attach(bufnr, false, {
on_detach = function()
rawset(t, bufnr, nil) -- clear cache
end
})
-
- rawset(t, bufnr, {})
-
- return rawget(t, bufnr)
+ t[bufnr] = {}
+ return t[bufnr]
end,
})
@@ -412,6 +395,7 @@ local function get_diagnostics(bufnr, opts, clamp)
end
end
elseif namespace == nil then
+ bufnr = get_bufnr(bufnr)
for iter_namespace in pairs(diagnostic_cache[bufnr]) do
for _, diagnostic in pairs(diagnostic_cache[bufnr][iter_namespace]) do
add(diagnostic)
@@ -424,6 +408,7 @@ local function get_diagnostics(bufnr, opts, clamp)
end
end
else
+ bufnr = get_bufnr(bufnr)
for _, diagnostic in pairs(diagnostic_cache[bufnr][namespace] or {}) do
add(diagnostic)
end
@@ -659,6 +644,8 @@ function M.set(namespace, bufnr, diagnostics, opts)
opts = {opts, 't', true},
}
+ bufnr = get_bufnr(bufnr)
+
if vim.tbl_isempty(diagnostics) then
diagnostic_cache[bufnr][namespace] = nil
else
@@ -1320,7 +1307,7 @@ function M.reset(namespace, bufnr)
bufnr = {bufnr, 'n', true},
}
- local buffers = bufnr and {bufnr} or vim.tbl_keys(diagnostic_cache)
+ local buffers = bufnr and {get_bufnr(bufnr)} or vim.tbl_keys(diagnostic_cache)
for _, iter_bufnr in ipairs(buffers) do
local namespaces = namespace and {namespace} or vim.tbl_keys(diagnostic_cache[iter_bufnr])
for _, iter_namespace in ipairs(namespaces) do
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 7433e7c04d..a380164a51 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -831,9 +831,9 @@ function lsp.start_client(config)
root_uri = workspace_folders[1].uri
root_path = vim.uri_to_fname(root_uri)
else
- workspace_folders = vim.NIL
- root_uri = vim.NIL
- root_path = vim.NIL
+ workspace_folders = nil
+ root_uri = nil
+ root_path = nil
end
local initialize_params = {
@@ -851,15 +851,15 @@ function lsp.start_client(config)
-- The rootPath of the workspace. Is null if no folder is open.
--
-- @deprecated in favour of rootUri.
- rootPath = root_path;
+ rootPath = root_path or vim.NIL;
-- The rootUri of the workspace. Is null if no folder is open. If both
-- `rootPath` and `rootUri` are set `rootUri` wins.
- rootUri = root_uri;
+ rootUri = root_uri or vim.NIL;
-- The workspace folders configured in the client when the server starts.
-- This property is only available if the client supports workspace folders.
-- It can be `null` if the client supports workspace folders but none are
-- configured.
- workspaceFolders = workspace_folders;
+ workspaceFolders = workspace_folders or vim.NIL;
-- User provided initialization options.
initializationOptions = config.init_options;
-- The capabilities provided by the client (editor or tool)
@@ -879,7 +879,9 @@ function lsp.start_client(config)
rpc.notify('initialized', vim.empty_dict())
client.initialized = true
uninitialized_clients[client_id] = nil
- client.workspaceFolders = initialize_params.workspaceFolders
+ client.workspace_folders = workspace_folders
+ -- TODO(mjlbach): Backwards compatbility, to be removed in 0.7
+ client.workspaceFolders = client.workspace_folders
client.server_capabilities = assert(result.capabilities, "initialize result doesn't contain capabilities")
-- These are the cleaned up capabilities we use for dynamically deciding
-- when to send certain events to clients.
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 747d761730..d3ba766d89 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -369,7 +369,7 @@ end
function M.list_workspace_folders()
local workspace_folders = {}
for _, client in pairs(vim.lsp.buf_get_clients()) do
- for _, folder in pairs(client.workspaceFolders or {}) do
+ for _, folder in pairs(client.workspace_folders or {}) do
table.insert(workspace_folders, folder.name)
end
end
@@ -389,7 +389,7 @@ function M.add_workspace_folder(workspace_folder)
local params = util.make_workspace_params({{uri = vim.uri_from_fname(workspace_folder); name = workspace_folder}}, {{}})
for _, client in pairs(vim.lsp.buf_get_clients()) do
local found = false
- for _, folder in pairs(client.workspaceFolders or {}) do
+ for _, folder in pairs(client.workspace_folders or {}) do
if folder.name == workspace_folder then
found = true
print(workspace_folder, "is already part of this workspace")
@@ -398,10 +398,10 @@ function M.add_workspace_folder(workspace_folder)
end
if not found then
vim.lsp.buf_notify(0, 'workspace/didChangeWorkspaceFolders', params)
- if not client.workspaceFolders then
- client.workspaceFolders = {}
+ if not client.workspace_folders then
+ client.workspace_folders = {}
end
- table.insert(client.workspaceFolders, params.event.added[1])
+ table.insert(client.workspace_folders, params.event.added[1])
end
end
end
@@ -415,10 +415,10 @@ function M.remove_workspace_folder(workspace_folder)
if not (workspace_folder and #workspace_folder > 0) then return end
local params = util.make_workspace_params({{}}, {{uri = vim.uri_from_fname(workspace_folder); name = workspace_folder}})
for _, client in pairs(vim.lsp.buf_get_clients()) do
- for idx, folder in pairs(client.workspaceFolders) do
+ for idx, folder in pairs(client.workspace_folders) do
if folder.name == workspace_folder then
vim.lsp.buf_notify(0, 'workspace/didChangeWorkspaceFolders', params)
- client.workspaceFolders[idx] = nil
+ client.workspace_folders[idx] = nil
return
end
end
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index ae0242a312..c5a9f503d5 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
-" Last Change: 2021 Nov 14
+" Last Change: 2021 Nov 21
"
" WORK IN PROGRESS - Only the basics work
" Note: On MS-Windows you need a recent version of gdb. The one included with
@@ -289,8 +289,9 @@ func s:StartDebug_term(dict)
call chansend(s:gdb_job_id, 'set args ' . join(proc_args) . "\r")
endif
- " Connect gdb to the communication pty, using the GDB/MI interface
- call chansend(s:gdb_job_id, 'new-ui mi ' . commpty . "\r")
+ " Connect gdb to the communication pty, using the GDB/MI interface.
+ " Prefix "server" to avoid adding this to the history.
+ call chansend(s:gdb_job_id, 'server new-ui mi ' . commpty . "\r")
" Wait for the response to show up, users may not notice the error and wonder
" why the debugger doesn't work.
@@ -309,7 +310,7 @@ func s:StartDebug_term(dict)
let response = line1 . line2
if response =~ 'Undefined command'
echoerr 'Sorry, your gdb is too old, gdb 7.12 is required'
- call s:CloseBuffers()
+ call s:CloseBuffers()
return
endif
if response =~ 'New UI allocated'
@@ -504,7 +505,7 @@ func TermDebugSendCommand(cmd)
" needed once.
call jobstop(s:gdbjob)
else
- call s:SendCommand('-exec-interrupt')
+ Stop
endif
sleep 10m
endif
@@ -595,14 +596,14 @@ func s:DecodeMessage(quotedText)
if a:quotedText[i] == '\'
let i += 1
if a:quotedText[i] == 'n'
- " drop \n
- let i += 1
- continue
+ " drop \n
+ let i += 1
+ continue
elseif a:quotedText[i] == 't'
- " append \t
- let i += 1
- let result .= "\t"
- continue
+ " append \t
+ let i += 1
+ let result .= "\t"
+ continue
endif
endif
let result .= a:quotedText[i]
@@ -657,8 +658,8 @@ func s:EndDebugCommon()
if bufexists(bufnr)
exe bufnr .. "buf"
if exists('b:save_signcolumn')
- let &signcolumn = b:save_signcolumn
- unlet b:save_signcolumn
+ let &signcolumn = b:save_signcolumn
+ unlet b:save_signcolumn
endif
endif
endfor
@@ -769,7 +770,7 @@ func s:CommOutput(job_id, msgs, event)
elseif msg != ''
if msg =~ '^\(\*stopped\|\*running\|=thread-selected\)'
call s:HandleCursor(msg)
- elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,'
+ elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,' || msg =~ '^=breakpoint-modified,'
call s:HandleNewBreakpoint(msg)
elseif msg =~ '^=breakpoint-deleted,'
call s:HandleBreakpointDelete(msg)
@@ -809,12 +810,15 @@ func s:InstallCommands()
command Finish call s:SendCommand('-exec-finish')
command -nargs=* Run call s:Run(<q-args>)
command -nargs=* Arguments call s:SendCommand('-exec-arguments ' . <q-args>)
- command Stop call s:SendCommand('-exec-interrupt')
- " using -exec-continue results in CTRL-C in gdb window not working
if s:way == 'prompt'
+ command Stop call s:PromptInterrupt()
command Continue call s:SendCommand('continue')
else
+ command Stop call s:SendCommand('-exec-interrupt')
+ " using -exec-continue results in CTRL-C in the gdb window not working,
+ " communicating via commbuf (= use of SendCommand) has the same result
+ "command Continue call s:SendCommand('-exec-continue')
command Continue call chansend(s:gdb_job_id, "continue\r")
endif
@@ -913,20 +917,16 @@ func s:SetBreakpoint(at)
let do_continue = 0
if !s:stopped
let do_continue = 1
- if s:way == 'prompt'
- call s:PromptInterrupt()
- else
- call s:SendCommand('-exec-interrupt')
- endif
+ Stop
sleep 10m
endif
" Use the fname:lnum format, older gdb can't handle --source.
let at = empty(a:at) ?
- \ fnameescape(expand('%:p')) . ':' . line('.') : a:at
+ \ fnameescape(expand('%:p')) . ':' . line('.') : a:at
call s:SendCommand('-break-insert ' . at)
if do_continue
- call s:SendCommand('-exec-continue')
+ Continue
endif
endfunc
@@ -937,23 +937,32 @@ func s:ClearBreakpoint()
let bploc = printf('%s:%d', fname, lnum)
if has_key(s:breakpoint_locations, bploc)
let idx = 0
+ let nr = 0
for id in s:breakpoint_locations[bploc]
if has_key(s:breakpoints, id)
- " Assume this always works, the reply is simply "^done".
- call s:SendCommand('-break-delete ' . id)
- for subid in keys(s:breakpoints[id])
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
- endfor
- unlet s:breakpoints[id]
- unlet s:breakpoint_locations[bploc][idx]
- break
+ " Assume this always works, the reply is simply "^done".
+ call s:SendCommand('-break-delete ' . id)
+ for subid in keys(s:breakpoints[id])
+ exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
+ endfor
+ unlet s:breakpoints[id]
+ unlet s:breakpoint_locations[bploc][idx]
+ let nr = id
+ break
else
- let idx += 1
+ let idx += 1
endif
endfor
- if empty(s:breakpoint_locations[bploc])
- unlet s:breakpoint_locations[bploc]
+ if nr != 0
+ if empty(s:breakpoint_locations[bploc])
+ unlet s:breakpoint_locations[bploc]
+ endif
+ echomsg 'Breakpoint ' . id . ' cleared from line ' . lnum . '.'
+ else
+ echoerr 'Internal error trying to remove breakpoint at line ' . lnum . '!'
endif
+ else
+ echomsg 'No breakpoint to remove at line ' . lnum . '.'
endif
endfunc
@@ -965,44 +974,72 @@ func s:Run(args)
endfunc
func s:SendEval(expr)
- " clean up expression that may got in because of range
- " (newlines and surrounding spaces)
- let expr = a:expr
- if &filetype ==# 'cobol'
- " extra cleanup for COBOL: _every: expression ends with a period,
- " a trailing comma is ignored as it commonly separates multiple expr.
- let expr = substitute(expr, '\..*', '', '')
- let expr = substitute(expr, '[;\n]', ' ', 'g')
- let expr = substitute(expr, ',*$', '', '')
+ " check for "likely" boolean expressions, in which case we take it as lhs
+ if a:expr =~ "[=!<>]="
+ let exprLHS = a:expr
else
- let expr = substitute(expr, '\n', ' ', 'g')
+ " remove text that is likely an assignment
+ let exprLHS = substitute(a:expr, ' *=.*', '', '')
endif
- let expr = substitute(expr, '^ *\(.*\) *', '\1', '')
+ " encoding expression to prevent bad errors
+ let expr = a:expr
+ let expr = substitute(expr, '\\', '\\\\', 'g')
+ let expr = substitute(expr, '"', '\\"', 'g')
call s:SendCommand('-data-evaluate-expression "' . expr . '"')
- let s:evalexpr = expr
+ let s:evalexpr = exprLHS
endfunc
-" :Evaluate - evaluate what is under the cursor
+" :Evaluate - evaluate what is specified / under the cursor
func s:Evaluate(range, arg)
+ let expr = s:GetEvaluationExpression(a:range, a:arg)
+ let s:ignoreEvalError = 0
+ call s:SendEval(expr)
+endfunc
+
+" get what is specified / under the cursor
+func s:GetEvaluationExpression(range, arg)
if a:arg != ''
- let expr = a:arg
- let s:evalFromBalloonExpr = 0
+ " user supplied evaluation
+ let expr = s:CleanupExpr(a:arg)
+ " DSW: replace "likely copy + paste" assignment
+ let expr = substitute(expr, '"\([^"]*\)": *', '\1=', 'g')
elseif a:range == 2
let pos = getcurpos()
let reg = getreg('v', 1, 1)
let regt = getregtype('v')
normal! gv"vy
- let expr = @v
+ let expr = s:CleanupExpr(@v)
call setpos('.', pos)
call setreg('v', reg, regt)
let s:evalFromBalloonExpr = 1
else
+ " no evaluation provided: get from C-expression under cursor
+ " TODO: allow filetype specific lookup #9057
let expr = expand('<cexpr>')
let s:evalFromBalloonExpr = 1
endif
- let s:ignoreEvalError = 0
- call s:SendEval(expr)
+ return expr
+endfunc
+
+" clean up expression that may got in because of range
+" (newlines and surrounding whitespace)
+func s:CleanupExpr(expr)
+ " replace all embedded newlines/tabs/...
+ let expr = substitute( a:expr, '\s', ' ', 'g')
+
+ if &filetype ==# 'cobol'
+ " extra cleanup for COBOL: _every: expression ends with a period,
+ " a semicolon nmay be used instead of a space
+ " a trailing comma is ignored as it commonly separates multiple expr
+ let expr = substitute(expr, '\..*', '', '')
+ let expr = substitute(expr, ';', ' ', 'g')
+ let expr = substitute(expr, ',*$', '', '')
+ endif
+
+ " get rid of surrounding spaces
+ let expr = substitute(expr, '^ *\(.*\) *', '\1', '')
+ return expr
endfunc
let s:ignoreEvalError = 0
@@ -1246,15 +1283,15 @@ func s:HandleCursor(msg)
let curwinid = win_getid(winnr())
if win_gotoid(s:asmwin)
- let lnum = search('^' . s:asm_addr)
- if lnum == 0
- call s:SendCommand('disassemble $pc')
- else
- exe 'sign unplace ' . s:asm_id
- exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
- endif
+ let lnum = search('^' . s:asm_addr)
+ if lnum == 0
+ call s:SendCommand('disassemble $pc')
+ else
+ exe 'sign unplace ' . s:asm_id
+ exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
+ endif
- call win_gotoid(curwinid)
+ call win_gotoid(curwinid)
endif
endif
endif
@@ -1278,8 +1315,8 @@ func s:HandleCursor(msg)
exe 'sign unplace ' . s:pc_id
exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname
if !exists('b:save_signcolumn')
- let b:save_signcolumn = &signcolumn
- call add(s:signcolumn_buflist, bufnr())
+ let b:save_signcolumn = &signcolumn
+ call add(s:signcolumn_buflist, bufnr())
endif
setlocal signcolumn=yes
endif
@@ -1308,7 +1345,12 @@ endfunction
" Will update the sign that shows the breakpoint
func s:HandleNewBreakpoint(msg)
if a:msg !~ 'fullname='
- " a watch does not have a file name
+ " a watch or a pending breakpoint does not have a file name
+ if a:msg =~ 'pending='
+ let nr = substitute(a:msg, '.*number=\"\([0-9.]*\)\".*', '\1', '')
+ let target = substitute(a:msg, '.*pending=\"\([^"]*\)\".*', '\1', '')
+ echomsg 'Breakpoint ' . nr . ' (' . target . ') pending.'
+ endif
return
endif
for msg in s:SplitMsg(a:msg)
@@ -1352,6 +1394,7 @@ func s:HandleNewBreakpoint(msg)
if bufloaded(fname)
call s:PlaceSign(id, subid, entry)
endif
+ echomsg 'Breakpoint ' . nr . ' created at line ' . lnum . '.'
endfor
endfunc
@@ -1371,11 +1414,12 @@ func s:HandleBreakpointDelete(msg)
if has_key(s:breakpoints, id)
for [subid, entry] in items(s:breakpoints[id])
if has_key(entry, 'placed')
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
- unlet entry['placed']
+ exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
+ unlet entry['placed']
endif
endfor
unlet s:breakpoints[id]
+ echomsg 'Breakpoint ' . id . ' cleared.'
endif
endfunc
@@ -1396,7 +1440,7 @@ func s:BufRead()
for [id, entries] in items(s:breakpoints)
for [subid, entry] in items(entries)
if entry['fname'] == fname
- call s:PlaceSign(id, subid, entry)
+ call s:PlaceSign(id, subid, entry)
endif
endfor
endfor
@@ -1408,7 +1452,7 @@ func s:BufUnloaded()
for [id, entries] in items(s:breakpoints)
for [subid, entry] in items(entries)
if entry['fname'] == fname
- let entry['placed'] = 0
+ let entry['placed'] = 0
endif
endfor
endfor
diff --git a/runtime/syntax/indent.vim b/runtime/syntax/indent.vim
index ddeae67e0d..b2a1a0c85f 100644
--- a/runtime/syntax/indent.vim
+++ b/runtime/syntax/indent.vim
@@ -1,7 +1,8 @@
" Vim syntax file
-" Language: indent(1) configuration file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2010-01-23
+" Language: indent(1) configuration file
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2021 Nov 17
" indent_is_bsd: If exists, will change somewhat to match BSD implementation
"
" TODO: is the deny-all (a la lilo.vim nice or no?)...
@@ -27,7 +28,7 @@ syn region indentComment start='//' skip='\\$' end='$'
\ contains=indentTodo,@Spell
if !exists("indent_is_bsd")
- syn match indentOptions '-i\|--indentation-level\|-il\|--indent-level'
+ syn match indentOptions '-i\|--indent-level\|-il\|--indent-label'
\ nextgroup=indentNumber skipwhite skipempty
endif
syn match indentOptions '-\%(bli\|c\%([bl]i\|[dip]\)\=\|di\=\|ip\=\|lc\=\|pp\=i\|sbi\|ts\|-\%(brace-indent\|comment-indentation\|case-brace-indentation\|declaration-comment-column\|continuation-indentation\|case-indentation\|else-endif-column\|line-comments-indentation\|declaration-indentation\|indent-level\|parameter-indentation\|line-length\|comment-line-length\|paren-indentation\|preprocessor-indentation\|struct-brace-indentation\|tab-size\)\)'
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index 348b9de816..aacb8cf3ae 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -111,7 +111,7 @@ describe('vim.diagnostic', function()
it('retrieves diagnostics from all buffers and namespaces', function()
local result = exec_lua [[
local other_bufnr = vim.api.nvim_create_buf(true, false)
- local lines = {"1st line of text", "2nd line of text", "wow", "cool", "more", "lines"}
+ local lines = vim.api.nvim_buf_get_lines(diagnostic_bufnr, 0, -1, true)
vim.api.nvim_buf_set_lines(other_bufnr, 0, 1, false, lines)
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
@@ -128,6 +128,17 @@ describe('vim.diagnostic', function()
eq('Diagnostic #1', result[1].message)
end)
+ it('resolves buffer number 0 to the current buffer', function()
+ eq(2, exec_lua [[
+ vim.api.nvim_set_current_buf(diagnostic_bufnr)
+ vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
+ make_error('Diagnostic #1', 1, 1, 1, 1),
+ make_error('Diagnostic #2', 2, 1, 2, 1),
+ })
+ return #vim.diagnostic.get(0)
+ ]])
+ end)
+
it('saves and count a single error', function()
eq(1, exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {