Repository: neovim/neovim
File: runtime/lua/nvim/spellfile.lua (Lua)

Code before:
--- @field encoding string
--- @field dir string

--- A table with the following fields:
--- @class nvim.spellfile.Opts
---
--- The base URL from where the spellfiles are downloaded. Uses `g:spellfile_URL`
--- if it's set, otherwise https://ftp.nluug.nl/pub/vim/runtime/spell.
--- @field url string
---
--- Number of milliseconds after which the [vim.net.request()] times out.
--- (default: 15000)
--- @field timeout_ms integer

--- @type nvim.spellfile.Opts
local config = {
  url = vim.g.spellfile_URL or 'https://ftp.nluug.nl/pub/vim/runtime/spell',
  timeout_ms = 15000,
}

--- Configure spellfile download options. For example:
--- ```lua
--- require('nvim.spellfile').config({ url = '...' })
--- ```
--- @param opts nvim.spellfile.Opts? When omitted or `nil`, retrieve the
---   current configuration. Otherwise, a configuration table (see [nvim.spellfile.Opts]).
--- @return nvim.spellfile.Opts? : Current config if {opts} is omitted.
function M.config(opts)
  vim.validate('opts', opts, 'table', true)
  if not opts then
    return vim.deepcopy(config, true)
  end
  for k, v in
    pairs(opts --[[@as table<any,any>]])
  do
    config[k] = v
  end
end

--- TODO(justinmk): add on_done/on_err callbacks to download(), instead of exposing this?
---@type table<string, boolean>
M._done = {}

---@return string[]
local function rtp_list()
  return vim.opt.rtp:get()
end

---@param msg string
---@param level vim.log.levels?
local function notify(msg, level)

Review comment (suggestion):
`see [nvim.spellfile.Opts]` should never need to be mentioned in the docstring for that very same thing :) The help system or LSP should deal with that. https://github.com/neovim/neovim/pull/36205 may help.

Code after:
--- @field encoding string
--- @field dir string

--- A table with the following fields:
--- @class nvim.spellfile.Opts
---
--- The base URL from where the spellfiles are downloaded. Uses `g:spellfile_URL`
--- if it's set, otherwise https://ftp.nluug.nl/pub/vim/runtime/spell.
--- @field url string
---
--- Number of milliseconds after which the [vim.net.request()] times out.
--- (default: 15000)
--- @field timeout_ms integer

--- @type nvim.spellfile.Opts
local config = {
  url = vim.g.spellfile_URL or 'https://ftp.nluug.nl/pub/vim/runtime/spell',
  timeout_ms = 15000,
}

--- Configure spellfile download options. For example:
--- ```lua
--- require('nvim.spellfile').config({ url = '...' })
--- ```
--- @param opts nvim.spellfile.Opts? When omitted or `nil`, retrieve the
---   current configuration. Otherwise, a configuration table.
--- @return nvim.spellfile.Opts? : Current config if {opts} is omitted.
function M.config(opts)
  vim.validate('opts', opts, 'table', true)
  if not opts then
    return vim.deepcopy(config, true)
  end
  for k, v in
    pairs(opts --[[@as table<any,any>]])
  do
    config[k] = v
  end
end

--- TODO(justinmk): add on_done/on_err callbacks to download(), instead of exposing this?
---@type table<string, boolean>
M._done = {}

---@return string[]
local function rtp_list()
  return vim.opt.rtp:get()
end

---@param msg string
---@param level vim.log.levels?
local function notify(msg, level)