diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/health/provider.vim | 2 | ||||
-rw-r--r-- | runtime/autoload/man.vim | 9 | ||||
-rw-r--r-- | runtime/doc/options.txt | 1 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 2 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter/languagetree.lua | 24 |
5 files changed, 31 insertions, 7 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 94fd7cf505..112dd4354f 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -487,7 +487,7 @@ endfunction " Resolves Python executable path by invoking and checking `sys.executable`. function! s:python_exepath(invocation) abort - return s:normalize_path(system(a:invocation + return s:normalize_path(system(fnameescape(a:invocation) \ . ' -c "import sys; sys.stdout.write(sys.executable)"')) endfunction diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 5008b8cfaf..486ed99e3f 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -434,8 +434,11 @@ function! man#goto_tag(pattern, flags, info) abort let l:structured = [] for l:path in l:paths - let l:n = s:extract_sect_and_name_path(l:path)[1] - let l:structured += [{ 'name': l:n, 'path': l:path }] + let [l:sect, l:name] = s:extract_sect_and_name_path(l:path) + let l:structured += [{ + \ 'name': l:name, + \ 'title': l:name . '(' . l:sect . ')' + \ }] endfor if &cscopetag @@ -446,7 +449,7 @@ function! man#goto_tag(pattern, flags, info) abort return map(l:structured, { \ _, entry -> { \ 'name': entry.name, - \ 'filename': 'man://' . entry.path, + \ 'filename': 'man://' . entry.title, \ 'cmd': '1' \ } \ }) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b83d2c4484..6c42dd6739 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5166,6 +5166,7 @@ A jump table for the options with a short description can be found at |Q_op|. It is allowed to give an argument to the command, e.g. "csh -f". See |option-backslash| about including spaces and backslashes. Environment variables are expanded |:set_env|. + If the name of the shell contains a space, you might need to enclose it in quotes. Example: > :set shell=\"c:\program\ files\unix\sh.exe\"\ -f diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index b6a238f158..ae77b0a35a 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -47,7 +47,7 @@ Whenever you need to access the current syntax tree, parse the buffer: > tstree = parser:parse() -<This will return an immutable tree that represents the current state of the +<This will return a table of immutable trees that represent the current state of the buffer. When the plugin wants to access the state after a (possible) edit it should call `parse()` again. If the buffer wasn't edited, the same tree will be returned again without extra work. If the buffer was parsed before, diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua index ed07e73a55..a8b62e21b9 100644 --- a/runtime/lua/vim/treesitter/languagetree.lua +++ b/runtime/lua/vim/treesitter/languagetree.lua @@ -1,3 +1,4 @@ +local a = vim.api local query = require'vim.treesitter.query' local language = require'vim.treesitter.language' @@ -103,12 +104,14 @@ function LanguageTree:parse() parser:set_included_ranges(ranges) local tree, tree_changes = parser:parse(old_tree, self._source) + self:_do_callback('changedtree', tree_changes, tree) table.insert(self._trees, tree) vim.list_extend(changes, tree_changes) end else local tree, tree_changes = parser:parse(old_trees[1], self._source) + self:_do_callback('changedtree', tree_changes, tree) table.insert(self._trees, tree) vim.list_extend(changes, tree_changes) @@ -145,7 +148,6 @@ function LanguageTree:parse() self._valid = true - self:_do_callback('changedtree', changes) return self._trees, changes end @@ -234,6 +236,24 @@ end -- -- @param regions A list of regions this tree should manange and parse. function LanguageTree:set_included_regions(regions) + -- Transform the tables from 4 element long to 6 element long (with byte offset) + for _, region in ipairs(regions) do + for i, range in ipairs(region) do + if type(range) == "table" and #range == 4 then + -- TODO(vigoux): I don't think string parsers are useful for now + if type(self._source) == "number" then + local start_row, start_col, end_row, end_col = unpack(range) + -- Easy case, this is a buffer parser + -- TODO(vigoux): proper byte computation here, and account for EOL ? + local start_byte = a.nvim_buf_get_offset(self.bufnr, start_row) + start_col + local end_byte = a.nvim_buf_get_offset(self.bufnr, end_row) + end_col + + region[i] = { start_row, start_col, start_byte, end_row, end_col, end_byte } + end + end + end + end + self._regions = regions -- Trees are no longer valid now that we have changed regions. -- TODO(vigoux,steelsojka): Look into doing this smarter so we can use some of the @@ -413,7 +433,7 @@ local function region_contains(region, range) end function LanguageTree:contains(range) - for _, region in pairs(self._region) do + for _, region in pairs(self._regions) do if region_contains(region, range) then return true end |