mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	@@ -23,7 +23,7 @@ error('Cannot require a meta file')
 | 
			
		||||
--- @field conceal? boolean
 | 
			
		||||
--- @field spell? boolean
 | 
			
		||||
--- @field ui_watched? boolean
 | 
			
		||||
--- @field url? boolean
 | 
			
		||||
--- @field url? string
 | 
			
		||||
--- @field hl_mode? string
 | 
			
		||||
---
 | 
			
		||||
--- @field virt_text? [string, string][]
 | 
			
		||||
 
 | 
			
		||||
@@ -170,7 +170,7 @@ end
 | 
			
		||||
--- Returns all URLs at cursor, if any.
 | 
			
		||||
--- @return string[]
 | 
			
		||||
function M._get_urls()
 | 
			
		||||
  local urls = {}
 | 
			
		||||
  local urls = {} ---@type string[]
 | 
			
		||||
 | 
			
		||||
  local bufnr = vim.api.nvim_get_current_buf()
 | 
			
		||||
  local cursor = vim.api.nvim_win_get_cursor(0)
 | 
			
		||||
@@ -183,7 +183,7 @@ function M._get_urls()
 | 
			
		||||
  })
 | 
			
		||||
  for _, v in ipairs(extmarks) do
 | 
			
		||||
    local details = v[4]
 | 
			
		||||
    if details.url then
 | 
			
		||||
    if details and details.url then
 | 
			
		||||
      urls[#urls + 1] = details.url
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
@@ -195,7 +195,7 @@ function M._get_urls()
 | 
			
		||||
    local lang = ltree:lang()
 | 
			
		||||
    local query = vim.treesitter.query.get(lang, 'highlights')
 | 
			
		||||
    if query then
 | 
			
		||||
      local tree = ltree:tree_for_range(range)
 | 
			
		||||
      local tree = assert(ltree:tree_for_range(range))
 | 
			
		||||
      for _, match, metadata in query:iter_matches(tree:root(), bufnr, row, row + 1, { all = true }) do
 | 
			
		||||
        for id, nodes in pairs(match) do
 | 
			
		||||
          for _, node in ipairs(nodes) do
 | 
			
		||||
@@ -203,7 +203,8 @@ function M._get_urls()
 | 
			
		||||
              local url = metadata[id] and metadata[id].url
 | 
			
		||||
              if url and match[url] then
 | 
			
		||||
                for _, n in ipairs(match[url]) do
 | 
			
		||||
                  urls[#urls + 1] = vim.treesitter.get_node_text(n, bufnr, metadata[url])
 | 
			
		||||
                  urls[#urls + 1] =
 | 
			
		||||
                    vim.treesitter.get_node_text(n, bufnr, { metadata = metadata[url] })
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user