Skip to content

Commit

Permalink
feat: lua-dev is now neodev
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 14, 2022
1 parent 7b495ec commit b43d272
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 35 deletions.
6 changes: 6 additions & 0 deletions after/plugin/lua-dev.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package.preload["lua-dev"] = function()
return require("neodev")
end
package.preload["lua-dev.sumneko"] = function()
return require("neodev.sumneko")
end
File renamed without changes.
4 changes: 2 additions & 2 deletions lua/lua-dev/build/api.lua → lua/neodev/build/api.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local Annotations = require("lua-dev.build.annotations")
local Docs = require("lua-dev.build.docs")
local Annotations = require("neodev.build.annotations")
local Docs = require("neodev.build.docs")

---@class NvimApiInfo
---@field functions NvimApiFunction[]
Expand Down
4 changes: 2 additions & 2 deletions lua/lua-dev/build/docs.lua → lua/neodev/build/docs.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local Util = require("lua-dev.util")
local Annotations = require("lua-dev.build.annotations")
local Util = require("neodev.util")
local Annotations = require("neodev.build.annotations")

local M = {}

Expand Down
18 changes: 9 additions & 9 deletions lua/lua-dev/build/init.lua → lua/neodev/build/init.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
local Config = require("lua-dev.config")
local Util = require("lua-dev.util")

local Annotations = require("lua-dev.build.annotations")
local Api = require("lua-dev.build.api")
local Docs = require("lua-dev.build.docs")
local Mpack = require("lua-dev.build.mpack")
local Writer = require("lua-dev.build.writer")
local Options = require("lua-dev.build.options")
local Config = require("neodev.config")
local Util = require("neodev.util")

local Annotations = require("neodev.build.annotations")
local Api = require("neodev.build.api")
local Docs = require("neodev.build.docs")
local Mpack = require("neodev.build.mpack")
local Writer = require("neodev.build.writer")
local Options = require("neodev.build.options")

local M = {}

Expand Down
4 changes: 2 additions & 2 deletions lua/lua-dev/build/mpack.lua → lua/neodev/build/mpack.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local Annotations = require("lua-dev.build.annotations")
local util = require("lua-dev.util")
local Annotations = require("neodev.build.annotations")
local util = require("neodev.util")
local M = {}

---@class MpackFunction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local Docs = require("lua-dev.build.docs")
local Writer = require("lua-dev.build.writer")
local Annotations = require("lua-dev.build.annotations")
local Util = require("lua-dev.util")
local Docs = require("neodev.build.docs")
local Writer = require("neodev.build.writer")
local Annotations = require("neodev.build.annotations")
local Util = require("neodev.util")

---@class OptionInfo
---@field allows_duplicates boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local config = require("lua-dev.config")
local config = require("neodev.config")

---@class AnnotationWriter
---@field name string
Expand Down
2 changes: 1 addition & 1 deletion lua/lua-dev/config.lua → lua/neodev/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local M = {}
--- @class LuaDevOptions
M.defaults = {
library = {
enabled = true, -- when not enabled, lua-dev will not change any settings to the LSP server
enabled = true, -- when not enabled, neodev will not change any settings to the LSP server
-- these settings will be used for your neovim config directory
runtime = true, -- runtime path
types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
Expand Down
10 changes: 5 additions & 5 deletions lua/lua-dev/init.lua → lua/neodev/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ local function neoconf(config)
pcall(function()
require("neoconf.plugins").register({
on_schema = function(schema)
schema:import("lua-dev", config.defaults)
schema:set("lua-dev.library.plugins", {
schema:import("neodev", config.defaults)
schema:set("neodev.library.plugins", {
description = "true/false or an array of plugin names to enable",
anyOf = {
{ type = "boolean" },
Expand All @@ -19,14 +19,14 @@ end

---@param opts LuaDevOptions
function M.setup(opts)
local config = require("lua-dev.config")
local config = require("neodev.config")
config.setup(opts)
require("lua-dev.lsp").setup()
require("neodev.lsp").setup()

neoconf(config)

-- leave this for now for backward compatibility
local ret = require("lua-dev.sumneko").setup()
local ret = require("neodev.sumneko").setup()
ret.settings.legacy = true
---@diagnostic disable-next-line: undefined-field
return vim.tbl_deep_extend("force", {}, ret, config.options.lspconfig or {})
Expand Down
12 changes: 6 additions & 6 deletions lua/lua-dev/lsp.lua → lua/neodev/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local util = require("lua-dev.util")
local util = require("neodev.util")

local M = {}

function M.setup()
local opts = require("lua-dev.config").options
local opts = require("neodev.config").options

local lsputil = require("lspconfig.util")
local hook = lsputil.add_hook_after
Expand Down Expand Up @@ -45,7 +45,7 @@ function M.on_new_config(config, root_dir)
return util.exists(dir)
end, vim.fn.glob(root_dir .. "/**/lua", false, true))

local opts = require("lua-dev.config").merge()
local opts = require("neodev.config").merge()

opts.library.enabled = util.is_nvim_config(root_dir)

Expand All @@ -55,7 +55,7 @@ function M.on_new_config(config, root_dir)
end

pcall(function()
opts = require("neoconf").get("lua-dev", opts, { file = root_dir })
opts = require("neoconf").get("neodev", opts, { file = root_dir })
end)

pcall(opts.override, root_dir, opts.library)
Expand All @@ -76,13 +76,13 @@ function M.on_new_config(config, root_dir)
config.settings = vim.tbl_deep_extend(
"force",
config.settings or {},
require("lua-dev.sumneko").setup(opts, config.settings).settings
require("neodev.sumneko").setup(opts, config.settings).settings
)
for _, lib in ipairs(library) do
table.insert(config.settings.Lua.workspace.library, lib)
end

if require("lua-dev.config").options.experimental.pathStrict then
if require("neodev.config").options.experimental.pathStrict then
for _, lib in ipairs(lua_dirs) do
table.insert(config.settings.Lua.workspace.library, lib)
end
Expand Down
2 changes: 1 addition & 1 deletion lua/lua-dev/sumneko.lua → lua/neodev/sumneko.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local config = require("lua-dev.config")
local config = require("neodev.config")

local M = {}

Expand Down
4 changes: 2 additions & 2 deletions lua/lua-dev/util.lua → lua/neodev/util.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local config = require("lua-dev.config")
local config = require("neodev.config")
local M = {}

function M.fqn(fname)
Expand Down Expand Up @@ -78,7 +78,7 @@ function M.debug(msg)
end

function M.error(msg)
vim.notify_once(msg, vim.log.levels.ERROR, { title = "lua-dev.nvim" })
vim.notify_once(msg, vim.log.levels.ERROR, { title = "neodev.nvim" })
end

return M

0 comments on commit b43d272

Please sign in to comment.