diff options
Diffstat (limited to 'runtime/lua')
-rw-r--r-- | runtime/lua/vim/_defaults.lua | 1 | ||||
-rw-r--r-- | runtime/lua/vim/filetype.lua | 66 | ||||
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 7 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/codelens.lua | 10 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter/languagetree.lua | 9 |
5 files changed, 85 insertions, 8 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 90d05f67a5..2f02c2b389 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -93,6 +93,7 @@ do "':normal! @'.getcharstr().'<CR>'", { silent = true, expr = true, desc = ':help v_@-default' } ) + --- Map |gx| to call |vim.ui.open| on the identifier under the cursor do local function do_open(uri) diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index bbe1e2c89c..215be7fdc2 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -236,6 +236,7 @@ local extension = { bbclass = 'bitbake', bl = 'blank', blp = 'blueprint', + bp = 'bp', bsd = 'bsdl', bsdl = 'bsdl', bst = 'bst', @@ -252,7 +253,7 @@ local extension = { capnp = 'capnp', cdc = 'cdc', cdl = 'cdl', - toc = 'cdrtoc', + toc = detect_line1('\\contentsline', 'tex', 'cdrtoc'), cfc = 'cf', cfm = 'cf', cfi = 'cf', @@ -582,6 +583,9 @@ local extension = { ['sublime-settings'] = 'json', ['sublime-workspace'] = 'json', ['json-patch'] = 'json', + bd = 'json', + bda = 'json', + xci = 'json', json5 = 'json5', jsonc = 'jsonc', jsonl = 'jsonl', @@ -631,7 +635,7 @@ local extension = { livemd = 'livebook', lgt = 'logtalk', lotos = 'lotos', - lot = 'lotos', + lot = detect_line1('\\contentsline', 'tex', 'lotos'), lout = 'lout', lou = 'lout', ulpc = 'lpc', @@ -770,8 +774,11 @@ local extension = { papp = 'papp', pxml = 'papp', pas = 'pascal', - lpr = 'pascal', + lpr = detect_line1('<%?xml', 'xml', 'pascal'), dpr = 'pascal', + txtpb = 'pbtxt', + textproto = 'pbtxt', + textpb = 'pbtxt', pbtxt = 'pbtxt', g = 'pccts', pcmk = 'pcmk', @@ -1035,6 +1042,27 @@ local extension = { bbl = 'tex', latex = 'tex', sty = 'tex', + pgf = 'tex', + nlo = 'tex', + nls = 'tex', + out = 'tex', + thm = 'tex', + eps_tex = 'tex', + pygtex = 'tex', + pygstyle = 'tex', + clo = 'tex', + aux = 'tex', + brf = 'tex', + ind = 'tex', + lof = 'tex', + loe = 'tex', + nav = 'tex', + vrb = 'tex', + ins = 'tex', + tikz = 'tex', + bbx = 'tex', + cbx = 'tex', + beamer = 'tex', cls = detect.cls, texi = 'texinfo', txi = 'texinfo', @@ -1135,6 +1163,14 @@ local extension = { csproj = 'xml', wpl = 'xml', xmi = 'xml', + xpr = 'xml', + xpfm = 'xml', + spfm = 'xml', + bxml = 'xml', + xcu = 'xml', + xlb = 'xml', + xlc = 'xml', + xba = 'xml', xpm = detect_line1('XPM2', 'xpm2', 'xpm'), xpm2 = 'xpm2', xqy = 'xquery', @@ -1257,7 +1293,9 @@ local filename = { ['/etc/default/cdrdao'] = 'cdrdaoconf', ['/etc/defaults/cdrdao'] = 'cdrdaoconf', ['cfengine.conf'] = 'cfengine', + cgdbrc = 'cgdbrc', ['CMakeLists.txt'] = 'cmake', + ['.cling_history'] = 'cpp', ['.alias'] = detect.csh, ['.cshrc'] = detect.csh, ['.login'] = detect.csh, @@ -1265,6 +1303,8 @@ local filename = { ['csh.login'] = detect.csh, ['csh.logout'] = detect.csh, ['auto.master'] = 'conf', + ['texdoc.cnf'] = 'conf', + ['.x11vncrc'] = 'conf', ['configure.in'] = 'config', ['configure.ac'] = 'config', crontab = 'crontab', @@ -1290,9 +1330,13 @@ local filename = { npmrc = 'dosini', ['/etc/yum.conf'] = 'dosini', ['.npmrc'] = 'dosini', + ['pip.conf'] = 'dosini', ['setup.cfg'] = 'dosini', ['pudb.cfg'] = 'dosini', ['.coveragerc'] = 'dosini', + ['psprint.conf'] = 'dosini', + sofficerc = 'dosini', + ['mimeapps.list'] = 'dosini', ['/etc/pacman.conf'] = 'confini', ['mpv.conf'] = 'confini', dune = 'dune', @@ -1367,6 +1411,7 @@ local filename = { ['ipf.conf'] = 'ipfilter', ['ipf6.conf'] = 'ipfilter', ['ipf.rules'] = 'ipfilter', + ['.node_repl_history'] = 'javascript', ['Pipfile.lock'] = 'json', ['.firebaserc'] = 'json', ['.prettierrc'] = 'json', @@ -1397,12 +1442,14 @@ local filename = { ['.lsl'] = detect.lsl, ['.busted'] = 'lua', ['.luacheckrc'] = 'lua', + ['.lua_history'] = 'lua', ['config.ld'] = 'lua', ['rock_manifest'] = 'lua', ['lynx.cfg'] = 'lynx', ['m3overrides'] = 'm3build', ['m3makefile'] = 'm3build', ['cm3.cfg'] = 'm3quake', + ['.m4_history'] = 'm4', ['.followup'] = 'mail', ['.article'] = 'mail', ['.letter'] = 'mail', @@ -1476,6 +1523,8 @@ local filename = { ['MANIFEST.in'] = 'pymanifest', ['.pythonstartup'] = 'python', ['.pythonrc'] = 'python', + ['.python_history'] = 'python', + ['.jline-jython.history'] = 'python', SConstruct = 'python', qmldir = 'qmldir', ['.Rhistory'] = 'r', @@ -1494,6 +1543,8 @@ local filename = { Puppetfile = 'ruby', ['.irbrc'] = 'ruby', irbrc = 'ruby', + ['.irb_history'] = 'ruby', + irb_history = 'ruby', Vagrantfile = 'ruby', ['smb.conf'] = 'samba', screenrc = 'screen', @@ -1503,6 +1554,7 @@ local filename = { ['/etc/services'] = 'services', ['/etc/serial.conf'] = 'setserial', ['/etc/udev/cdsymlinks.conf'] = 'sh', + ['.ash_history'] = 'sh', ['bash.bashrc'] = detect.bash, bashrc = detect.bash, ['.bashrc'] = detect.bash, @@ -1519,6 +1571,7 @@ local filename = { ['/etc/slp.spi'] = 'slpspi', ['.slrnrc'] = 'slrnrc', ['sendmail.cf'] = 'sm', + ['.sqlite_history'] = 'sql', ['squid.conf'] = 'squid', ['ssh_config'] = 'sshconfig', ['sshd_config'] = 'sshdconfig', @@ -1531,7 +1584,10 @@ local filename = { ['undo.data'] = 'taskdata', ['.tclshrc'] = 'tcl', ['.wishrc'] = 'tcl', + ['.tclsh-history'] = 'tcl', ['tclsh.rc'] = 'tcl', + ['.xsctcmdhistory'] = 'tcl', + ['.xsdbcmdhistory'] = 'tcl', ['texmf.cnf'] = 'texmf', COPYING = 'text', README = 'text', @@ -1549,6 +1605,7 @@ local filename = { ['/.cargo/credentials'] = 'toml', ['Cargo.lock'] = 'toml', ['trustees.conf'] = 'trustees', + ['.ts_node_repl_history'] = 'typescript', ['/etc/udev/udev.conf'] = 'udevconf', ['/etc/updatedb.conf'] = 'updatedb', ['fdrupstream.log'] = 'upstreamlog', @@ -1695,6 +1752,8 @@ local pattern = { ['.*/%.aws/credentials'] = 'confini', ['.*/etc/pacman%.conf'] = 'confini', ['.*/etc/yum%.conf'] = 'dosini', + ['.*/lxqt/.*%.conf'] = 'dosini', + ['.*/screengrab/.*%.conf'] = 'dosini', ['.*lvs'] = 'dracula', ['.*lpe'] = 'dracula', ['.*/dtrace/.*%.d'] = 'dtrace', @@ -2023,6 +2082,7 @@ local pattern = { ['.*termcap.*'] = starsetf(function(path, bufnr) return require('vim.filetype.detect').printcap('term') end), + ['.*/tex/latex/.*%.cfg'] = 'tex', ['.*%.t%.html'] = 'tilde', ['%.?tmux.*%.conf'] = 'tmux', ['%.?tmux.*%.conf.*'] = { 'tmux', { priority = -1 } }, diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index ca2c53b75d..c48984d151 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -458,6 +458,9 @@ end --- @type vim.filetype.mapfn function M.def(_, bufnr) + if getline(bufnr, 1):find('%%%%') then + return 'tex' + end if vim.g.filetype_def == 'modula2' or is_modula2(bufnr) then return modula2(bufnr) end @@ -738,7 +741,9 @@ end --- @type vim.filetype.mapfn function M.inp(_, bufnr) - if getline(bufnr, 1):find('^%*') then + if getline(bufnr, 1):find('%%%%') then + return 'tex' + elseif getline(bufnr, 1):find('^%*') then return 'abaqus' else for _, line in ipairs(getlines(bufnr, 1, 500)) do diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index d2557ca9d7..a2a0c15b93 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -79,7 +79,7 @@ function M.run() local lenses_by_client = lens_cache_by_buf[bufnr] or {} for client, lenses in pairs(lenses_by_client) do for _, lens in pairs(lenses) do - if lens.range.start.line == (line - 1) then + if lens.range.start.line == (line - 1) and lens.command and lens.command.command ~= '' then table.insert(options, { client = client, lens = lens }) end end @@ -231,7 +231,7 @@ local function resolve_lenses(lenses, bufnr, client_id, callback) countdown() else assert(client) - client.request('codeLens/resolve', lens, function(_, result) + client.request(ms.codeLens_resolve, lens, function(_, result) if api.nvim_buf_is_loaded(bufnr) and result and result.command then lens.command = result.command -- Eager display to have some sort of incremental feedback @@ -306,7 +306,11 @@ function M.refresh(opts) textDocument = util.make_text_document_params(buf), } active_refreshes[buf] = true - vim.lsp.buf_request(buf, ms.textDocument_codeLens, params, M.on_codelens) + + local request_ids = vim.lsp.buf_request(buf, ms.textDocument_codeLens, params, M.on_codelens) + if vim.tbl_isempty(request_ids) then + active_refreshes[buf] = nil + end end end end diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua index 8f65cb57c3..990debc77b 100644 --- a/runtime/lua/vim/treesitter/languagetree.lua +++ b/runtime/lua/vim/treesitter/languagetree.lua @@ -1100,7 +1100,14 @@ end ---@param range Range ---@return boolean local function tree_contains(tree, range) - return Range.contains({ tree:root():range() }, range) + local tree_ranges = tree:included_ranges(false) + + return Range.contains({ + tree_ranges[1][1], + tree_ranges[1][2], + tree_ranges[#tree_ranges][3], + tree_ranges[#tree_ranges][4], + }, range) end --- Determines whether {range} is contained in the |LanguageTree|. |