Skip to content

Commit

Permalink
refactoring, cleaning up, removing gitmodules for now
Browse files Browse the repository at this point in the history
  • Loading branch information
clpi committed Jan 12, 2025
1 parent 5306296 commit d187ed1
Show file tree
Hide file tree
Showing 88 changed files with 7,774 additions and 7,190 deletions.
11 changes: 0 additions & 11 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
instead of having it under `[module].config` - [ ] If necessary, then make inter-module config accessibility under `[module].config` instead of `module.config`
- [ ] (easy) Change config to be under
- [ ] (easy) Consider removing `[module].load` `[module].maps` `[module].opts` `[module].cmds` and merge all into `[module].setup` due to redundancy
- [ ] (easy) Remove all lingering instances of `[module].data.data` and merge into `[module].data`
- [ ] (easy) Remove all lingering instances of `[module]..` and merge into `[module].`
- [ ] (easy) Consider another separation of tables and functions of a module
- [ ] (easy) Fix `ui.calendar` for `note` module
- [ ] (easy) Fix mod popup window buffer close error
Expand Down
71 changes: 30 additions & 41 deletions book/lua/module/examples/barebones.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
---@brief Let's go through the most boilerplate, simple example of a module you may use.
---@brief This module will have no real functionality,
local mod = require "down.mod"

local mod = require 'down.mod'

---@brief Let's say you want to create a module for Jupyter notebooks to run in Neovim.
---@brief We'll start by just creating a barebones module, with no functionality, just to show you how.
---@brief We will name this module "jupyter".
---@type down.Mod
local J = mod.create("jupyter", {

---@brief This is where we would automatically call any submodules underneath "jupyter" to be called in
---@brief simultaneously as it is loaded. Since we do not have any such submodules, we will leave this empty.
local J = mod.new 'jupyter'

})
---@brief This is where we would automatically call any submodules underneath "jupyter" to be called in
---@brief simultaneously as it is loaded. Since we do not have any such submodules, we will leave this empty.

--[[ 1. Flow of functions:
Expand All @@ -37,39 +34,33 @@ function J.setup()
---@brief through in such an early stage. Taking a guess, however, and knowing we can always change,
---@brief we'll just choose a few which we will likely need regardless.
requires = {
"data",
"workspace",
"data.code",
"ui.progress",
"ui.status",
"ui.notify",
"ui.vtext"
}
'data',
'workspace',
'data.code',
'ui.progress',
'ui.status',
'ui.notify',
'ui.vtext',
},
}
end

---@brief This is where we will set up the module's data and any methods it will call.
---@class down.jupyter.Data
J.data = {

---@brief One such piece of data you may wish to store is the ongoing collection of cells, as well
---@brief as their contents and type in the Juypyter notebook. You may even wish to leverage the
---@brief down.lua `lsp.notebook` module to hook into the LSP for Jupyter notebooks.
cells = {

},

---@brief To keep track of the notebook currently being interacted with
notebook = {

path = nil,
---@brief One such piece of data you may wish to store is the ongoing collection of cells, as well
---@brief as their contents and type in the Juypyter notebook. You may even wish to leverage the
---@brief down.lua `lsp.notebook` module to hook into the LSP for Jupyter notebooks.
J.cells = {}

name = nil,
---@brief To keep track of the notebook currently being interacted with
J.notebook = {

kernel = "python3",
path = nil,

}
name = nil,

kernel = 'python3',
}

---@brief Technically, we have now created a proper module that can be loaded into Neovim through down.lua.
Expand All @@ -92,27 +83,25 @@ J.config = {
---@brief consider that a user will likely want to change several of the values.
notebook = {

default = "notebook.ipynb",
default = 'notebook.ipynb',

dir = {

workspace = "default",

default = "notes",
}
workspace = 'default',

default = 'notes',
},
},

service = "jupyter",
service = 'jupyter',

command = "jupyterlab",
command = 'jupyterlab',

kernel = "python3",
kernel = 'python3',

kernels = {
"python3"
}

'python3',
},
}

---@brief There are many more aspects to a module that can and should be defined as you begin to flesh it out,
Expand Down
2 changes: 1 addition & 1 deletion book/lua/module/examples/basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ M.config = {
}

---@class example.Data
M.data = {
M. = {
--- @brief module data
--- the home of the module's internal data and methods
--- TODO: split up concerns
Expand Down
16 changes: 3 additions & 13 deletions book/src/modules/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ end

---@brief This is where we will set up the module's data and any methods it will call.
---@class down.jupyter.Data
J.data = {

---@brief One such piece of data you may wish to store is the ongoing collection of cells, as well
---@brief as their contents and type in the Juypyter notebook. You may even wish to leverage the
---@brief down.lua `lsp.notebook` module to hook into the LSP for Jupyter notebooks.
cells = {
J.cells = {

},
}

---@brief To keep track of the notebook currently being interacted with
notebook = {
J.notebook = {

path = nil,

Expand All @@ -76,7 +75,6 @@ J.data = {

}

}

---@brief Technically, we have now created a proper module that can be loaded into Neovim through down.lua.
---@brief However, we will be typically be best off at the beginning characterizing the module with any
Expand Down Expand Up @@ -175,14 +173,6 @@ M.config = {
--- ...
}

---@class example.Data
M.data = {
--- @brief module data
--- the home of the module's internal data and methods
--- TODO: split up concerns
--- ...
}

M.load = function()
--- @brief module load
--- a set of functions to run whenever the
Expand Down
8 changes: 0 additions & 8 deletions book/src/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ M.config = {
--- ...
}

---@class example.Data
M.data = {
--- @brief module data
--- the home of the module's internal data and methods
--- TODO: split up concerns
--- ...
}

M.load = function()
--- @brief module load
Expand All @@ -61,4 +54,3 @@ end
return M

```

1 change: 0 additions & 1 deletion ext/lsp
Submodule lsp deleted from 65fef1
1 change: 0 additions & 1 deletion ext/rsp
Submodule rsp deleted from aea697
1 change: 0 additions & 1 deletion ext/vsc
Submodule vsc deleted from 14c6d0
34 changes: 30 additions & 4 deletions lua/down.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,44 @@ function Down:start()
for name, usermod in pairs(self.config.user) do
if type(usermod) == 'table' then
if name == 'lsp' and self.config.dev == false then
goto continue
elseif name == 'log' then
if type(usermod) == 'table' then
Down.config.log = usermod
elseif type(usermod) == 'number' and usermod >= 0 and usermod <= 4 then
Down.config.log.level = Down.util.log.number_level[usermod] or 'info'
elseif type(usermod) == 'boolean' then
Down.config.log.level = 'info'
elseif type(usermod) == 'string' then
if
usermod == 'trace'
or usermod == 'debug'
or usermod == 'info'
or usermod == 'warn'
or usermod == 'error'
or usermod == 'fatal'
then
Down.config.log.level = usermod
end
end
elseif name == 'workspaces' then
goto continue
elseif name == 'workspace' then
goto continue
elseif self.mod.load_mod(name, usermod) == nil then
end
else
self.config[name] = usermod
end
::continue::
end
vim.api.nvim_create_autocmd('BufEnter',
{
callback = function()
for _, l in pairs(Down.mod.mods) do
Down.mod.load_maps(l)
Down.mod.load_opts(l)
end
end,
pattern = "markdown",
}
)
self.config.mod = self.mod.mods
self.config:post_load()
self:post_load()
Expand Down
Loading

0 comments on commit d187ed1

Please sign in to comment.