diff --git a/book/lua/module/examples/advanced.lua b/book/lua/module/examples/advanced.lua new file mode 100644 index 0000000..209dc11 --- /dev/null +++ b/book/lua/module/examples/advanced.lua @@ -0,0 +1 @@ +-- TODO: diff --git a/book/lua/module/examples/barebones.lua b/book/lua/module/examples/barebones.lua new file mode 100644 index 0000000..54c36a8 --- /dev/null +++ b/book/lua/module/examples/barebones.lua @@ -0,0 +1,125 @@ +---@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" + + +---@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. + +}) + +--[[ 1. Flow of functions: + + +-------+ load mod +------------------+ +------+ +----------+ + | setup |>----------->| cmds, opts, maps |>| load |>| postload | + +-------+ set data +------------------+ +------+ +----------+ + +--]] + +---@brief This is where the module will first be `setup`. As you can see above, this occurs before a module has +---@brief fully loaded its data it needs to function. It may, however, perform important functionality during +---@brief this step, such as specifying dependencies it will need, setting up configuration, defining variables, +---@brief or even defining commands and autocommands that will invoke its functionality. +---@brief It must only return a table generally containing a confirmation it has loaded, as well as its +---@brief dependencies, except on rare occasions. +---@return down.mod.Setup +function J.setup() + ---@class down.mod.Setup + return { + loaded = true, + ---@brief For a jupyter module, we will likely need several dependencies, perhaps too many to list + ---@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" + } + } +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, + + name = nil, + + kernel = "python3", + + } + +} + +---@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 +---@brief setup, dependencies, configuration, commands, and even keymaps you believe it may one day need. + +---@brief Each modue has a config table specified, which is where the user may set any configuration options +---@brief changing the behaviour of the module. + +---@class down.jupyter.Config +---@field kernal string: The kernel to use for the Jupyter user interface. Default is `python3 +J.config = { + + ---@brief The default directory you might want to specify for Jupyter notebooks to be stored in. + ---@brief You may also wish to leverage the required "workspace" module to allow users to specify both + ---@brief a specific workspace tey would like to associate with Jupyter notebooks, as well as a default + ---@brief relative directory within that workspace. + --- + ---@brief Configuration details about created notebooks. While you are specifying default values here, + ---@brief consider that a user will likely want to change several of the values. + notebook = { + + default = "notebook.ipynb", + + dir = { + + workspace = "default", + + default = "notes", + } + + }, + + service = "jupyter", + + command = "jupyterlab", + + kernel = "python3", + + kernels = { + "python3" + } + +} + +---@brief There are many more aspects to a module that can and should be defined as you begin to flesh it out, +---@brief even before you begin to test any major functionality. These include defining commands, options, +---@brief mappings, not to mention learning the interdependencies between your module and other modules, +---@brief whether builtin or custom-made by the community. +--- +---@brief Regardless, I hope this has provided a good starting point to help you to take the very first steps +---@brief in creating an awesome module to extend and bless the down.lua ecosystem. Good luck and godspeed! +return J diff --git a/book/lua/module/example.lua b/book/lua/module/examples/basic.lua similarity index 73% rename from book/lua/module/example.lua rename to book/lua/module/examples/basic.lua index b98ced1..8939778 100644 --- a/book/lua/module/example.lua +++ b/book/lua/module/examples/basic.lua @@ -1,8 +1,14 @@ -local down = require("down") +-- TODO: do-over -local mod, config, util = down.mod, down.config, down.util +--- @brief First, import the module class for type suggestions and checking +local mod = require "down.mod" -local M = mod.create("user.example", { +---@brief Your first module will likely be a root (parentless) module. +--- Typically, a `.` separates the name in the module name only if +--- it separates the parent module name (left) from the child (right). +--- However, you may choose to quickly +---@type word.Mod +local M = mod.create("user.mod", { --- @brief submodules --- child directories containing --- modules to load in tandem, relative diff --git a/lua/down/mod/integration/README.md b/book/lua/module/examples/ui.lua similarity index 100% rename from lua/down/mod/integration/README.md rename to book/lua/module/examples/ui.lua diff --git a/lua/down/mod/integration/blink/README.md b/book/lua/module/guide/1/1. intro.md similarity index 100% rename from lua/down/mod/integration/blink/README.md rename to book/lua/module/guide/1/1. intro.md diff --git a/lua/down/mod/integration/cmp/README.md b/book/lua/module/guide/1/2. basics.md similarity index 100% rename from lua/down/mod/integration/cmp/README.md rename to book/lua/module/guide/1/2. basics.md diff --git a/lua/down/mod/integration/coq/README.md b/book/lua/module/guide/1/3. functionality.md similarity index 100% rename from lua/down/mod/integration/coq/README.md rename to book/lua/module/guide/1/3. functionality.md diff --git a/book/lua/module/guide/1/README.md b/book/lua/module/guide/1/README.md new file mode 100644 index 0000000..75655a1 --- /dev/null +++ b/book/lua/module/guide/1/README.md @@ -0,0 +1 @@ +# The beginner's guide to building a module diff --git a/lua/down/mod/integration/coq/init.lua b/book/lua/module/guide/2/1. intro.md similarity index 100% rename from lua/down/mod/integration/coq/init.lua rename to book/lua/module/guide/2/1. intro.md diff --git a/book/lua/module/guide/2/README.md b/book/lua/module/guide/2/README.md new file mode 100644 index 0000000..5ca69a3 --- /dev/null +++ b/book/lua/module/guide/2/README.md @@ -0,0 +1 @@ +# The intermediate guide to building a module diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index 4c8b5cf..ca1067c 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -3,18 +3,17 @@ Welcome -- to the `down.lua` book. I hope this helps! - [Intro](./intro.md) -- [Philosophy](./philosophy.md) -- [Setup](./setup.md) - [About](./about/index.md) - - [Options](./about/options.md) - - [Commands](./about/commands.md) - - [Autocommands](./about/autocommands.md) + - [Philosophy](./philosophy.md) - [Compare](./about/compare.md) - [Configuring](./config/index.md) - [Setting up](./config/setting-up.md) + - [Options](./about/options.md) + - [Commands](./about/commands.md) + - [Autocommands](./about/autocommands.md) - [Keymaps](./config/keymaps.md) - [Basic](./config/basic.md) - [Advanced](./config/advanced.md) @@ -29,8 +28,13 @@ Welcome -- to the `down.lua` book. I hope this helps! - [Modules](./modules/index.md) - [Introduction](./modules/intro.md) - - [Examples](./modules/example.md) + - [Examples](./modules/examples.md) + - [Barebones](./../lua/module/examples/barebones.lua) + - [Basic](./../lua/module/examples/basic.lua) - [Quickstart](./modules/quickstart.md) + - [Bultin Overview](./modules/builtin.md) + - [Full Overview](./modules/core.md) + - [Further Reading](./modules/further.md) - [Customizing](./customizing/index.md) @@ -61,10 +65,10 @@ Welcome -- to the `down.lua` book. I hope this helps! - [General](./plans/general.md) - [Todo](./plans/todo.md) -- [Support](./support.md) +- [Contributing](./contributing/index.md) - - [Issues](./contributing/issues.md) - - [Contributing](./contributing/discussions.md) + - [Contributing to Issues](./contributing/issues.md) + - [Contributing to Discussions](./contributing/discussions.md) - [Sponsorship](./contributing/sponsorship.md) - [Tools](./tools/index.md) @@ -79,5 +83,4 @@ Welcome -- to the `down.lua` book. I hope this helps! - [Contributing](./contributing/intro.md) - [Roadmap](./roadmap.md) -- [Credits](./credits.md) - [Map](./index.md) diff --git a/book/src/philosophy.md b/book/src/about/philosophy.md similarity index 100% rename from book/src/philosophy.md rename to book/src/about/philosophy.md diff --git a/book/src/about/autocommands.md b/book/src/config/autocommands.md similarity index 100% rename from book/src/about/autocommands.md rename to book/src/config/autocommands.md diff --git a/book/src/about/commands.md b/book/src/config/commands.md similarity index 100% rename from book/src/about/commands.md rename to book/src/config/commands.md diff --git a/book/src/about/options.md b/book/src/config/options.md similarity index 100% rename from book/src/about/options.md rename to book/src/config/options.md diff --git a/book/src/credits.md b/book/src/credits.md deleted file mode 100644 index e94d007..0000000 --- a/book/src/credits.md +++ /dev/null @@ -1 +0,0 @@ -# Credits diff --git a/book/src/help.md b/book/src/help.md deleted file mode 100644 index 61d37c0..0000000 --- a/book/src/help.md +++ /dev/null @@ -1 +0,0 @@ -# Help diff --git a/book/src/modules/builtin.md b/book/src/modules/builtin.md new file mode 100644 index 0000000..17dd135 --- /dev/null +++ b/book/src/modules/builtin.md @@ -0,0 +1,43 @@ +# The core builtin module directory + +`Accurate as of December 15, 2024` + +Here is the full guide to all the modules, which I intend to keep largely perminantely in this arrangement so far as I can muster, and so far as it provides a good experience for everyone. + +I will also not be changing the names to any of the modules, switching them around willy-nilly, etc., and especially not changing the name of the project, which is `down.lua`, after its most recent overhaul. + +This is a project in its extremely early days, so perhaps I may be laying this down too soon and without any real consequence, but I believe that the system, naming, etc. has congealed to the point where I can +safely believe in the foundations it has laid. + +> [!Tip] +> +> On a lighter note, working on this project for this long has been an incredible pleasure, and I hope I can impart some of the wonderful flights of fancy my mind would necessarily take +> when stumbling upon what I believed to be a great (at the moment, perhaps) idea. Building an extensible and dev-friendly environment like this, I hope this is something I can share! + + +## The primary core modules are + +Below, you will find a list of the primary **root** core modules builtin to `down.lua`. There are a few things beyond the obvious that should be stated first: + +1. While I have intended for all modules to be useful in their own right in a context not involving internal use, I do have to note that, like all things, there is a certain variance with regards how accessible a given builtin module is, as well as how much use it may serve to you. + To that end, I have tried to begin scaffolding a per-module README.md that should (at some point) provide any others contributing or building on top of `down.lua` what they may and may not get out of the builtin modules here. + +2. The hierarchy of modules presented here is very important to understand, both with regards its structure and its purpose. This becomes especially important when considering the control flow of the setup process, both for the plugin as a whole and indeed to a lesser degree for + the individual modules themselves. It can be easy to at first get lost in the weeds here, but I don't believe it is something that should hinder those exploring the codebase very long at all. + +3. As you can see, nearly allo of the builtin base modules have a number of submodules. A creator of a module which has another module (builtin or external) as its parent may, with the ability to affect the code of the parent, the ability to choose whether the module shouuld be + loaded in whenever the parent is loaded in, or to be specified by the user (or through other means: e.g. through configurations, dependencies, and other module interdependencies). + +| **id** | name | purpose | submodules | status | +| ------ | ----------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | `cmd` | provides the core logic to allow other moduless and users to create their own custom commands. | `back`, `mod`, `rename`, `find` | good! no changes anticipated at the moment besides a few possible refactors. | +| 2 | `data` | provides database and file-storage capabilities, through a variety of means and methods. | `clipboard`, `code`, `dirs`, `encrypt`, `export`, `log`, `media`, `metadata`, `mod`, `save`, `sync`, `tag`, `template`, `time`, `todo` | essential internally already, but will take time | +| 3 | `edit` | provides direct editing capabilities when interacting with files, and performs indirect analysis of files. | `conceal`, `cursor`, `find`, `fold`, `hl`, `indent`, `rk inline`, `link`, `parse`, `syntax`, `toc`, `todo` | essential internally already, but will take time | +| 4 | `lsp` | provides as much language-server-protocol-enabled functionality as possible without compromising rapidity. | `command`, `completion`, `declaration`, `definition`, `document`, `implementation`, `moniker`, `notebook`, `refactor`, `reference`, `type`, `window`, `workspace` | the lsp development process, not a surprise, will be a rather laborous endeavour | +| 5 | `note` | provides a journaling environment where notes can be created and leveraged in various powerful ways. | `...` | while more will always be added, the note functionality is fortunately well under way | +| 5 | `tool` | provides interoperability with external tooling, enabling emergent possibilities. | `blink`, `cmp`, `coq`, `dcmp`, `fzf`, `lualine`, `pandoc`, `telescope`, `treesitter`, `trouble` | whie a few modules are well on their way, there are a few I'd like (blink, telescope, etc.) | +| 5 | `ui` | provides internal ui functionality, and may be leveraged by users or devs withing to expand their own environment. | `calendar`, `chat`, `dashboard`, `icon`, `nav`, `popup`, `progress`, `prompt`, `render`, `sidebar`, `status`, `win` | ui as a whole has not been an early priority, and it shows. | +| 5 | `workspace` | provides the core workspace or vault logic, keeping spaces compartmentalized appropriately. | `...` | the workspace module has been without any issue thus far, although I would like to clean it up. | +| 5 | `config` | without configuration, will initalize a set of default modules most will use, but may be customized. | `...` | Similarly, no problems with the ultra-simple config module, although I do wish to add meaningful options | + +`Accurate as of December 15, 2024` diff --git a/book/src/modules/core.md b/book/src/modules/core.md new file mode 100644 index 0000000..f400222 --- /dev/null +++ b/book/src/modules/core.md @@ -0,0 +1,7 @@ +# The full overview of the builtin modules + +Hierarchy included! + +## The hierarchy of modules + +`...` diff --git a/book/src/modules/example.md b/book/src/modules/example.md deleted file mode 100644 index cbe17da..0000000 --- a/book/src/modules/example.md +++ /dev/null @@ -1,62 +0,0 @@ -## Example custom module - -```lua -local down = require("down") - -local mod, config, util = down.mod, down.config, down.util - -local M = mod.create("user.example", { - --- @brief submodules - --- child directories containing - --- modules to load in tandem, relative - --- to this (parent) module. - --- "subexample", - --- "pre_example", - --- ... -}) - -M.setup = function() - return { - requires = { - ---@brief required modules - --- modules from builtin or custom - --- modules that can be loaded in (same as - --- if calling `require 'module'`) as a dependency - --- for the module. - --- "ui.popup", - --- "edit.link", - --- "integration.treesitter", - --- ... - }, - loaded = true, - } -end - ----@class (exact) example.Config -M.config = { - --- @brief module config - --- the public facing config for this module that can be - --- set by the user from its default values here. - --- ... -} - ----@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 - --- module is fist loaded upon startup. - --- TODO: maybe just merge in with setup() - --- ... -end - -return M -``` - -- See [example.lua](../../lua/module/example.lua) diff --git a/book/src/modules/examples.md b/book/src/modules/examples.md new file mode 100644 index 0000000..92bcdbd --- /dev/null +++ b/book/src/modules/examples.md @@ -0,0 +1,197 @@ +# Examples of user custom modules + + +## Example of a barebones module + +```lua +---@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" + + +---@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. + +}) + +--[[ 1. Flow of functions: + + +-------+ load mod +------------------+ +------+ +----------+ + | setup |>----------->| cmds, opts, maps |>| load |>| postload | + +-------+ set data +------------------+ +------+ +----------+ + +--]] + +---@brief This is where the module will first be `setup`. As you can see above, this occurs before a module has +---@brief fully loaded its data it needs to function. It may, however, perform important functionality during +---@brief this step, such as specifying dependencies it will need, setting up configuration, defining variables, +---@brief or even defining commands and autocommands that will invoke its functionality. +---@brief It must only return a table generally containing a confirmation it has loaded, as well as its +---@brief dependencies, except on rare occasions. +---@return down.mod.Setup +function J.setup() + ---@class down.mod.Setup + return { + loaded = true, + ---@brief For a jupyter module, we will likely need several dependencies, perhaps too many to list + ---@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" + } + } +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, + + name = nil, + + kernel = "python3", + + } + +} + +---@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 +---@brief setup, dependencies, configuration, commands, and even keymaps you believe it may one day need. + +---@brief Each modue has a config table specified, which is where the user may set any configuration options +---@brief changing the behaviour of the module. + +---@class down.jupyter.Config +---@field kernal string: The kernel to use for the Jupyter user interface. Default is `python3 +J.config = { + + ---@brief The default directory you might want to specify for Jupyter notebooks to be stored in. + ---@brief You may also wish to leverage the required "workspace" module to allow users to specify both + ---@brief a specific workspace tey would like to associate with Jupyter notebooks, as well as a default + ---@brief relative directory within that workspace. + --- + ---@brief Configuration details about created notebooks. While you are specifying default values here, + ---@brief consider that a user will likely want to change several of the values. + notebook = { + + default = "notebook.ipynb", + + dir = { + + workspace = "default", + + default = "notes", + } + + }, + + service = "jupyter", + + command = "jupyterlab", + + kernel = "python3", + + kernels = { + "python3" + } + +} + +---@brief There are many more aspects to a module that can and should be defined as you begin to flesh it out, +---@brief even before you begin to test any major functionality. These include defining commands, options, +---@brief mappings, not to mention learning the interdependencies between your module and other modules, +---@brief whether builtin or custom-made by the community. +--- +---@brief Regardless, I hope this has provided a good starting point to help you to take the very first steps +---@brief in creating an awesome module to extend and bless the down.lua ecosystem. Good luck and godspeed! +return J +``` + +## Example custom module + +Note that the below example is **out of date** and needs to be updated. Thanks! + +```lua +local down = require("down") + +local mod, config, util = down.mod, down.config, down.util + +local M = mod.create("user.example", { + --- @brief submodules + --- child directories containing + --- modules to load in tandem, relative + --- to this (parent) module. + --- "subexample", + --- "pre_example", + --- ... +}) + +M.setup = function() + return { + requires = { + ---@brief required modules + --- modules from builtin or custom + --- modules that can be loaded in (same as + --- if calling `require 'module'`) as a dependency + --- for the module. + --- "ui.popup", + --- "edit.link", + --- "integration.treesitter", + --- ... + }, + loaded = true, + } +end + +---@class (exact) example.Config +M.config = { + --- @brief module config + --- the public facing config for this module that can be + --- set by the user from its default values here. + --- ... +} + +---@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 + --- module is fist loaded upon startup. + --- TODO: maybe just merge in with setup() + --- ... +end + +return M +``` + +- See [example.lua](../../lua/module/example.lua) diff --git a/book/src/modules/further.md b/book/src/modules/further.md new file mode 100644 index 0000000..78d6da8 --- /dev/null +++ b/book/src/modules/further.md @@ -0,0 +1 @@ +# Further reading on modules diff --git a/book/src/options.md b/book/src/options.md deleted file mode 100644 index f607e58..0000000 --- a/book/src/options.md +++ /dev/null @@ -1 +0,0 @@ -# Options diff --git a/book/src/setup.md b/book/src/setup.md deleted file mode 100644 index feae8cb..0000000 --- a/book/src/setup.md +++ /dev/null @@ -1 +0,0 @@ -# Setup diff --git a/book/src/support.md b/book/src/support.md deleted file mode 100644 index 85d1c29..0000000 --- a/book/src/support.md +++ /dev/null @@ -1 +0,0 @@ -# Support diff --git a/ext/dlsp/.cargo/config.toml b/ext/dlsp/.cargo/config.toml new file mode 100644 index 0000000..e6a7662 --- /dev/null +++ b/ext/dlsp/.cargo/config.toml @@ -0,0 +1,20 @@ +[alias] +b = "build" +r = "run" +t = "test" +c = "check" +R = "run --release" +rx = "R --example --recursions" +sx = ["run", "--release", "--", "\"command_list\""] + +[env] +WORD_LSP_NAME = "wordlsp" +PATH = "$PATH" +CACHE = "$HOME/.cache/$WORD_LSP_NAME" +TEMPD = "$HOME/.tm/$WORD_LSP_NAME" +DATAD = "$HOME/.local/share/$WORD_LSP_NAME" +STATE = "$HOME/.local/state/$WORD_LSP_NAME" +CONFD = "$HOME/.config/$WORD_LSP_NAME" + +[cargo-new] +vcs = "git" diff --git a/ext/dlsp/Cargo.toml b/ext/dlsp/Cargo.toml new file mode 100644 index 0000000..2dfdba8 --- /dev/null +++ b/ext/dlsp/Cargo.toml @@ -0,0 +1,24 @@ +[workspace] +resolver = "2" +members = ['./lib/client', "./lib/serve"] +exclude = [] + +[workspace.package] +name = "down-lsp" +version = "0.1.0" +license = "MIT" +license-file = "./LICNESE" +readme = "./README.md" +authors = [ + "Chris Pecunies " +] +edition = "2021" + +[workspace.metadata] + + +[workspace.dependencies] +tokio = { version = "1.42.0", features = ["full"] } +tower-lsp = { version = "0.20.0", features = ["tokio", "tokio-util"] } +tower = { version = "0.5.1", features = ["full"] } +tokio-util = { version = "0.7.12", features = ["full"] } diff --git a/ext/dlsp/LICENSE b/ext/dlsp/LICENSE new file mode 100644 index 0000000..16a5d4d --- /dev/null +++ b/ext/dlsp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Chris Pecunies + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ext/dlsp/README.md b/ext/dlsp/README.md new file mode 100644 index 0000000..d1e3dd1 --- /dev/null +++ b/ext/dlsp/README.md @@ -0,0 +1,309 @@ +# down.lua + +the _familiar_, organized future for neovim and beyond! + + ![Neovim](https://img.shields.io/badge/Neovim%200.10+-brightgreen?style=for-the-badge) + ![License](https://img.shields.io/badge/license-GPL%20v3-brightgreen?style=for-the-badge) +![LuaRocks](https://img.shields.io/luarocks/v/clpi/down.lua) + +--- + +> [!Caution] +> +> `down.lua` is currently in **early** *ongoing* development. + + + +- [down - the _familiar_, organized future for neovim](#down-the-familiar-organized-future-for-neovim) + - [Introduction](#introduction) + - [Requirements](#requirements) + - [Quickstart](#quickstart) + - [Config](#config) + - [Usage](#usage) + - [Todo](#todo) + - [Support](#support) + - [Credits](#credits) + + +## Introduction + +- `down.lua` is a [neovim](#) plugin intended to bring the extensibility of [org-mode](#) or [neorg](github.com/nvim-neorg/neorg) with the **comfort** of [markdown](#). + +- In its [current state](#), `down.lua` is in the beginning stages of development, currently functionining as a markdown-based version of [neorg](#), with many planned features to come + +- we want to be able to take notes like developers, without leaving behind all the ecosystem benefits of markdown. + +- it's a work in progress and will be updated regularly + +## Requirements + +> [!Note] +> +> `down.lua` must have at least [neovim 0.10+](https://neovim.io) + +## Quickstart + +
+ +lazy.nvim + + +```lua +-- Place in lazy.nvim spec +{ + "clpi/down.lua", + version = "*", + lazy = false, + branch = "master", + config = function() + require "down".setup { + mod = { + workspace = { + config = { + default = "notes", + workspaces = { + default = "~/down", + notes = "~/notes", + personal = "~/home" + } + } + } + } + } + end, + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "pysan3/pathlib.nvim", + "nvim-telescope/telescope.nvim", -- optional + }, +} +``` + +
+ +--- + +
+ + +plug.vim + + +> [!Caution] +> +> Not yet tested + +```vim +Plug "nvim-telescope/telescope.nvim" +Plug "nvim-treesitter/treesitter.nvim" +Plug "nvim-lua/plenary.nvim", +Plug "MunifTanjim/nui.nvim", +Plug "pysan3/pathlib.nvim" +Plug "clpi/down.lua", { + \ "branch" : "master", + \ "do" : ':lua require([[down]]).setup({ + \ mod = { + \ workspace = { + \ config = { + \ workspaces = { + \ wiki = [[~/wiki]], + \ default = [[~/down]], + \ notes = [[~/notes]] + \ } + \ } + \ } + \ } + \ })' + \ } +``` + +
+ +--- + +
+Vundle + +> [!Caution] +> +> Not yet tested + +```vim +Plugin "pysan3/pathlib.nvim" +Plugin 'nvim-telescope/telescope.nvim' +Plugin "nvim-lua/plenary.nvim", +Plugin "MunifTanjim/nui.nvim", +Plugin 'clpi/down.lua' +``` + +
+ +--- + +
+ + +dein.vim + + +> [!Caution] +> +> Not yet tested + +```vim +call dein#add("nvim-lua/plenary.nvim") +call dein#add("MunifTanjim/nui.nvim") +call dein#add('pysan3/pathlib.nvim') +call dein#add('nvim-telescope/telescope.nvim') +call dein#add('clpi/down.lua') +``` + +
+ +--- + +
+ + +packer.nvim + + +> [!Caution] +> +> Not yet tested + +```lua +use { + "clp/down.lua", + requires = { + "nvim-telescope/telescope.nvim", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "pysan3/pathlib.nvim" + }, + tag = "*", + branch = 'master', + config = function() + require("down").setup({ + mod = { + workspace = { + config = { + workspaces = { + default = "~/down", + home = "~/notes", + notes = "~/notes" + } + } + } + } + }) + end, +} +``` + +
+ +--- + +
+ + +mini.deps + + +> [!Caution] +> +> Not yet tested + +```lua +{ + "clp/down.lua", +} +``` + +
+ +--- + +
+ + +rocks.nvim + + +> [!Caution] +> +> Not yet tested + +``` +:Rocks install mini.lua +``` + +
+ +## Config + +```lua +-- Setup the initial config +-- with workspace 'home' at ~/home +-- and make it default +require("down").setup({ ---@type down.mod.Config + mod = { + workspace = { + config = { + default = 'home', + workspaces = { + default = "~/down", + home = "~/notes", + notes = "~/notes" + } + } + } + } +}) +``` + +## Usage + +### Modules + +- `config` - configuration settings + +### Default Modules + +`...` + +## Todo + +> [!Tip] +> +> Check out [TODO.md](./TODO.md) for a more detailed list of tasks + +## Contributing + +> [!Tip] +> +> Check out [CONTRIBUTING.md](./CONTRIBUTING.md) for a more detailed overview of how to contribute + +## Credits + +`down.lua` is a project by [clpi](github.com/clpi) and is licensed under the [MIT](./LICENSE) license. For information about **contributing**, please consult the [CONTRIBUTING.md](./CONTRIBUTING.md) file. + +special thanks goes to [nvim-neorg/neorg](https://github.com/nvim-neorg/neorg) for providing the inspiration and basis of this project. + +--- + +thank you and keep updated! + +- [The `down.lua` book](https://down.cli.st) +- [The `down.lua` wiki](https://github.com/clpi/down.lua/wiki) +- [`down.lua` on luarocks](https://luarocks.org/inits/clpi/down.lua) +- [`down.lua` on dotfyle](https://dotfyle.com/plugins/clpi/down.lua) + + +

(back to top)

+ + + diff --git a/ext/dlsp/lib/client/Cargo.toml b/ext/dlsp/lib/client/Cargo.toml new file mode 100644 index 0000000..87c8051 --- /dev/null +++ b/ext/dlsp/lib/client/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "client" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/ext/dlsp/lib/client/src/lib.rs b/ext/dlsp/lib/client/src/lib.rs new file mode 100644 index 0000000..b93cf3f --- /dev/null +++ b/ext/dlsp/lib/client/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/ext/dlsp/lib/serve/Cargo.toml b/ext/dlsp/lib/serve/Cargo.toml new file mode 100644 index 0000000..0d30e39 --- /dev/null +++ b/ext/dlsp/lib/serve/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "serve" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/ext/dlsp/lib/serve/src/lib.rs b/ext/dlsp/lib/serve/src/lib.rs new file mode 100644 index 0000000..b93cf3f --- /dev/null +++ b/ext/dlsp/lib/serve/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/ext/dlsp/src/lib.rs b/ext/dlsp/src/lib.rs new file mode 100644 index 0000000..b93cf3f --- /dev/null +++ b/ext/dlsp/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/lua/down/mod.lua b/lua/down/mod.lua index 5a225ef..dfbe0c5 100644 --- a/lua/down/mod.lua +++ b/lua/down/mod.lua @@ -20,6 +20,7 @@ Mod = setmetatable({}, { end, }) +---@param name string The name of the new mod Mod.default = function(name) return { setup = function() @@ -75,7 +76,6 @@ Mod.default = function(name) import = {}, } end --- local cmd = require("down.cmd") --- @param name string The name of the new init. Modake sure this is unique. The recommended naming convention is `category.modn` or `category.subcategory.modn`. --- @param imports? string[] A list of imports to attach to the init. Import data is requestable via `init.required`. Use paths relative to the current init. @@ -107,30 +107,30 @@ function Mod.create(name, imports) return new end ---- Constructs a default array of modules +--[[ + Flow of functions: + + +-------+ load mod +------------------+ +------+ + | setup |>----------->| cmds, opts, maps |>| load | + +-------+ set data +------------------+ +------+ + +--]] +--- Constructs a default array of modules, +--- NOTE: Specifically for the introductory `config` module --- @param name string The name of the new metainit. Modake sure this is unique. The recommended naming convention is `category.modn` or `category.subcategory.modn`. --- @param ... string A list of init names to load. --- @return down.Mod Mod.modules = function(name, ...) ---@type down.Mod local m = Mod.create(name) - m.config.enable = { ... } - -- print(ms[0]) - -- print(m.config.enable[0]) - m.setup = function() return { loaded = true } end - if m.cmds then - m.cmds() - end - if m.opts then - m.opts() - end - if m.maps then - m.maps() - end + -- TODO: consider removing + if m.cmds then m.cmds() end + if m.opts then m.opts() end + if m.maps then m.maps() end m.load = function() m.config.enable = (function() @@ -155,19 +155,9 @@ Mod.modules = function(name, ...) end return m end - --- TODO: What goes below this line until the next notice used to belong to mod --- We need to find a way to make these functions easier to maintain - ---- Tracks the amount of currently loaded mod. Mod.loaded_mod_count = 0 - ---- The table of currently loaded mod --- @type { [string]: down.Mod } Mod.loaded_mod = {} - ---- Loads and enables a init ---- Loads a specified init. If the init subscribes to any events then they will be activated too. --- @param m down.Mod The actual init to load. --- @return boolean # Whether the init successfully loaded. function Mod.load_mod_from_table(m) @@ -271,17 +261,14 @@ function Mod.load_mod_from_table(m) -- Loop through each dependency and load it one by one for _, req_mod in pairs(mod_load.requires) do log.trace("Loading submod" .. req_mod) - if not Mod.is_mod_loaded(req_mod) then - -- print(req_mod) if not Mod.load_mod(req_mod) then log.error( ("Unable to load init %s, required dependency %s did not load successfully"):format( - m.name, + m.name .. req_mod ) ) - -- Modake sure to clean up after ourselves if the init failed to load Mod.loaded_mod[m.name] = nil return false @@ -289,7 +276,6 @@ function Mod.load_mod_from_table(m) else log.trace("mod" .. req_mod .. "already loaded, skipping...") end - -- Create a reference to the dependency's public table m.required[req_mod] = Mod.loaded_mod[req_mod].data end @@ -309,10 +295,8 @@ function Mod.load_mod_from_table(m) mod_to_replace.name ) ) - -- Modake sure to clean up after ourselves if the init failed to load Mod.loaded_mod[m.name] = nil - return false end diff --git a/lua/down/mod/README.md b/lua/down/mod/README.md index b9691a2..757aa34 100644 --- a/lua/down/mod/README.md +++ b/lua/down/mod/README.md @@ -1 +1,43 @@ -# For core modules +# The core module directory + +`Accurate as of December 15, 2024` + +Here is the full guide to all the modules, which I intend to keep largely perminantely in this arrangement so far as I can muster, and so far as it provides a good experience for everyone. + +I will also not be changing the names to any of the modules, switching them around willy-nilly, etc., and especially not changing the name of the project, which is `down.lua`, after its most recent overhaul. + +This is a project in its extremely early days, so perhaps I may be laying this down too soon and without any real consequence, but I believe that the system, naming, etc. has congealed to the point where I can +safely believe in the foundations it has laid. + +> [!Tip] +> +> On a lighter note, working on this project for this long has been an incredible pleasure, and I hope I can impart some of the wonderful flights of fancy my mind would necessarily take +> when stumbling upon what I believed to be a great (at the moment, perhaps) idea. Building an extensible and dev-friendly environment like this, I hope this is something I can share! + + +## The primary core modules are + +Below, you will find a list of the primary **root** core modules builtin to `down.lua`. There are a few things beyond the obvious that should be stated first: + +1. While I have intended for all modules to be useful in their own right in a context not involving internal use, I do have to note that, like all things, there is a certain variance with regards how accessible a given builtin module is, as well as how much use it may serve to you. + To that end, I have tried to begin scaffolding a per-module README.md that should (at some point) provide any others contributing or building on top of `down.lua` what they may and may not get out of the builtin modules here. + +2. The hierarchy of modules presented here is very important to understand, both with regards its structure and its purpose. This becomes especially important when considering the control flow of the setup process, both for the plugin as a whole and indeed to a lesser degree for + the individual modules themselves. It can be easy to at first get lost in the weeds here, but I don't believe it is something that should hinder those exploring the codebase very long at all. + +3. As you can see, nearly allo of the builtin base modules have a number of submodules. A creator of a module which has another module (builtin or external) as its parent may, with the ability to affect the code of the parent, the ability to choose whether the module shouuld be + loaded in whenever the parent is loaded in, or to be specified by the user (or through other means: e.g. through configurations, dependencies, and other module interdependencies). + +| **id** | name | purpose | submodules | status | +| ------ | ----------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | `cmd` | provides the core logic to allow other moduless and users to create their own custom commands. | `back`, `mod`, `rename`, `find` | good! no changes anticipated at the moment besides a few possible refactors. | +| 2 | `data` | provides database and file-storage capabilities, through a variety of means and methods. | `clipboard`, `code`, `dirs`, `encrypt`, `export`, `log`, `media`, `metadata`, `mod`, `save`, `sync`, `tag`, `template`, `time`, `todo` | essential internally already, but will take time | +| 3 | `edit` | provides direct editing capabilities when interacting with files, and performs indirect analysis of files. | `conceal`, `cursor`, `find`, `fold`, `hl`, `indent`, `rk inline`, `link`, `parse`, `syntax`, `toc`, `todo` | essential internally already, but will take time | +| 4 | `lsp` | provides as much language-server-protocol-enabled functionality as possible without compromising rapidity. | `command`, `completion`, `declaration`, `definition`, `document`, `implementation`, `moniker`, `notebook`, `refactor`, `reference`, `type`, `window`, `workspace` | the lsp development process, not a surprise, will be a rather laborous endeavour | +| 5 | `note` | provides a journaling environment where notes can be created and leveraged in various powerful ways. | `...` | while more will always be added, the note functionality is fortunately well under way | +| 5 | `tool` | provides interoperability with external tooling, enabling emergent possibilities. | `blink`, `cmp`, `coq`, `dcmp`, `fzf`, `lualine`, `pandoc`, `telescope`, `treesitter`, `trouble` | whie a few modules are well on their way, there are a few I'd like (blink, telescope, etc.) | +| 5 | `ui` | provides internal ui functionality, and may be leveraged by users or devs withing to expand their own environment. | `calendar`, `chat`, `dashboard`, `icon`, `nav`, `popup`, `progress`, `prompt`, `render`, `sidebar`, `status`, `win` | ui as a whole has not been an early priority, and it shows. | +| 5 | `workspace` | provides the core workspace or vault logic, keeping spaces compartmentalized appropriately. | `...` | the workspace module has been without any issue thus far, although I would like to clean it up. | +| 5 | `config` | without configuration, will initalize a set of default modules most will use, but may be customized. | `...` | Similarly, no problems with the ultra-simple config module, although I do wish to add meaningful options | + +`Accurate as of December 15, 2024` diff --git a/lua/down/mod/config.lua b/lua/down/mod/config.lua index a9ace6c..b222a4d 100644 --- a/lua/down/mod/config.lua +++ b/lua/down/mod/config.lua @@ -7,8 +7,8 @@ local M = require("down.mod").modules( "note", "cmd", "workspace", - "integration.telescope", - "integration.treesitter", + "tool.telescope", + "tool.treesitter", "data", "lsp", "edit" diff --git a/lua/down/mod/data/code/init.lua b/lua/down/mod/data/code/init.lua index 0d65449..5bd496c 100644 --- a/lua/down/mod/data/code/init.lua +++ b/lua/down/mod/data/code/init.lua @@ -37,7 +37,7 @@ M.setup = function() end return { requires = { - "integration.treesitter", + "tool.treesitter", "data", "cmd", }, @@ -59,7 +59,7 @@ end M.data = { code = function(buffer) ---@type base.treesitter - local treesitter = M.required["integration.treesitter"] + local treesitter = M.required["tool.treesitter"] local parsed_document_metadata = treesitter.get_document_metadata(buffer) or {} local code_settings = parsed_document_metadata.code or {} diff --git a/lua/down/mod/data/encrypt/init.lua b/lua/down/mod/data/encrypt/init.lua index d51b4fa..15f9d96 100644 --- a/lua/down/mod/data/encrypt/init.lua +++ b/lua/down/mod/data/encrypt/init.lua @@ -22,7 +22,7 @@ E.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", "cmd", "workspace", }, diff --git a/lua/down/mod/data/export/init.lua b/lua/down/mod/data/export/init.lua index 96020ed..d86b3c4 100644 --- a/lua/down/mod/data/export/init.lua +++ b/lua/down/mod/data/export/init.lua @@ -22,7 +22,7 @@ E.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", "cmd", "workspace", }, diff --git a/lua/down/mod/data/log/init.lua b/lua/down/mod/data/log/init.lua index e69f8cc..18c3694 100644 --- a/lua/down/mod/data/log/init.lua +++ b/lua/down/mod/data/log/init.lua @@ -43,7 +43,7 @@ M.setup = function() "ui.win", "ui.progress", "workspace", - "integration.treesitter", + "tool.treesitter", }, } end diff --git a/lua/down/mod/data/template/init.lua b/lua/down/mod/data/template/init.lua index 26e9dbe..e44d272 100644 --- a/lua/down/mod/data/template/init.lua +++ b/lua/down/mod/data/template/init.lua @@ -38,7 +38,7 @@ M.setup = function() loaded = true, requires = { "workspace", - "integration.treesitter", + "tool.treesitter", }, } end diff --git a/lua/down/mod/data/todo/init.lua b/lua/down/mod/data/todo/init.lua index 1d23fad..f92e3ce 100644 --- a/lua/down/mod/data/todo/init.lua +++ b/lua/down/mod/data/todo/init.lua @@ -42,7 +42,7 @@ M.config = { M.setup = function() return { loaded = true, - requires = { "integration.treesitter" }, + requires = { "tool.treesitter" }, } end @@ -79,7 +79,7 @@ function M.data.attach_introspector(buffer) ) end - M.required["integration.treesitter"].execute_query( + M.required["tool.treesitter"].execute_query( [[ (_ state: (detached_modifier_extension)) @item @@ -104,7 +104,7 @@ function M.data.attach_introspector(buffer) ---@type TSNode? local node = - M.required["integration.treesitter"].get_first_node_on_line(buf, first) + M.required["tool.treesitter"].get_first_node_on_line(buf, first) if not node then return @@ -135,7 +135,7 @@ function M.data.attach_introspector(buffer) introspect(node) local node_above = - M.required["integration.treesitter"].get_first_node_on_line( + M.required["tool.treesitter"].get_first_node_on_line( buf, first - 1 ) diff --git a/lua/down/mod/edit/cursor/init.lua b/lua/down/mod/edit/cursor/init.lua index c1ee5eb..aee5201 100644 --- a/lua/down/mod/edit/cursor/init.lua +++ b/lua/down/mod/edit/cursor/init.lua @@ -4,7 +4,7 @@ local tu = require("nvim-treesitter.ts_utils") function L.setup() return { requires = { - "integration.treesitter", + "tool.treesitter", "workspace", }, loaded = true, diff --git a/lua/down/mod/edit/parse/init.lua b/lua/down/mod/edit/parse/init.lua index dfadd56..6bb5b26 100644 --- a/lua/down/mod/edit/parse/init.lua +++ b/lua/down/mod/edit/parse/init.lua @@ -25,7 +25,7 @@ P.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", }, } end diff --git a/lua/down/mod/edit/syntax/init.lua b/lua/down/mod/edit/syntax/init.lua index a1a86d0..9d8c7cc 100644 --- a/lua/down/mod/edit/syntax/init.lua +++ b/lua/down/mod/edit/syntax/init.lua @@ -25,7 +25,7 @@ M.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", }, } end @@ -92,7 +92,7 @@ M.data = { end -- If the tree is valid then attempt to perform the query - local tree = M.required["integration.treesitter"].get_document_root(buf) + local tree = M.required["tool.treesitter"].get_document_root(buf) if tree then -- get the language node used by the code block diff --git a/lua/down/mod/edit/toc/init.lua b/lua/down/mod/edit/toc/init.lua index 1457dc8..e88ebc1 100644 --- a/lua/down/mod/edit/toc/init.lua +++ b/lua/down/mod/edit/toc/init.lua @@ -31,7 +31,7 @@ M.setup = function() -- }) -- end return { - requires = { "integration.treesitter", "ui", "cmd" }, + requires = { "tool.treesitter", "ui", "cmd" }, } end @@ -122,7 +122,7 @@ M.data = { parse_toc_macro = function(buffer) local toc, toc_name = false, nil - local success = M.required["integration.treesitter"].execute_query( + local success = M.required["tool.treesitter"].execute_query( [[ (infirm_tag (tag_name) @name @@ -133,7 +133,7 @@ M.data = { if capture_name == "name" - and M.required["integration.treesitter"] + and M.required["tool.treesitter"] .get_node_text(node, buffer) :lower() == "toc" @@ -141,7 +141,7 @@ M.data = { toc = true elseif capture_name == "parameters" and toc then toc_name = - M.required["integration.treesitter"].get_node_text(node, buffer) + M.required["tool.treesitter"].get_node_text(node, buffer) return true end end, @@ -183,11 +183,11 @@ M.data = { if prefix and title then local prefix_text = - M.required["integration.treesitter"].get_node_text( + M.required["tool.treesitter"].get_node_text( prefix, original_buffer ) - local title_text = M.required["integration.treesitter"].get_node_text( + local title_text = M.required["tool.treesitter"].get_node_text( title, original_buffer ) @@ -279,7 +279,7 @@ M.data = { ) local down_root = - M.required["integration.treesitter"].get_document_root(down_buffer) + M.required["tool.treesitter"].get_document_root(down_buffer) if not down_root then return end diff --git a/lua/down/mod/edit/todo/init.lua b/lua/down/mod/edit/todo/init.lua index 8fd19d3..bc87266 100644 --- a/lua/down/mod/edit/todo/init.lua +++ b/lua/down/mod/edit/todo/init.lua @@ -4,7 +4,7 @@ local log, mod = down.log, down.mod local M = mod.create("edit.todo") M.setup = function() - return { loaded = true, requires = { "integration.treesitter" } } + return { loaded = true, requires = { "tool.treesitter" } } end M.load = function() @@ -239,7 +239,7 @@ M.data = { return end - local range = M.required["integration.treesitter"].get_node_range( + local range = M.required["tool.treesitter"].get_node_range( first_status_extension ) @@ -274,7 +274,7 @@ M.data = { ---@return userdata? #The node if it was located, else nil get_todo_from_cursor = function(buf, line) local node_at_cursor = - M.required["integration.treesitter"].get_first_node_on_line(buf, line) + M.required["tool.treesitter"].get_first_node_on_line(buf, line) if not node_at_cursor then return @@ -357,7 +357,7 @@ M.data = { { "(" .. char .. ") " } ) else - local range = M.required["integration.treesitter"].get_node_range( + local range = M.required["tool.treesitter"].get_node_range( first_status_extension ) diff --git a/lua/down/mod/integration/blink/init.lua b/lua/down/mod/integration/blink/init.lua deleted file mode 100644 index 94e954f..0000000 --- a/lua/down/mod/integration/blink/init.lua +++ /dev/null @@ -1,15 +0,0 @@ -local mod = require("down.mod") - ----@type down.Mod -local M = mod.create("integration.blink") - -local has_blink, blink = pcall(require, "blink.cmp") - ----@class down.integration.blink.Config -M.config = {} ----@class down.integration.blink.Data -M.data = {} -M.data.source = require("down.mod.integration.blink.source") -M.data.format = require("down.mod.integration.blink.format") - -return M diff --git a/lua/down/mod/integration/lualine/init.lua b/lua/down/mod/integration/lualine/init.lua deleted file mode 100644 index 45a838f..0000000 --- a/lua/down/mod/integration/lualine/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -local mod = require("down.mod") ----@type down.Mod -local L = mod.create("integration.lualine") - -return L diff --git a/lua/down/mod/integration/telescope/new.lua b/lua/down/mod/integration/telescope/new.lua deleted file mode 100644 index 88839cc..0000000 --- a/lua/down/mod/integration/telescope/new.lua +++ /dev/null @@ -1,147 +0,0 @@ -local M = Mod.create("integration.telescope") -local k = vim.keymap.set - -M.setup = function() - return { - loaded = true, - requires = { "cmd", "workspace" } - } -end - -M.data.data = { - picker_names = { - "linkable", - "lsp", - "link", - "todo", - "actions", - "note", - "files", - -- "insert_link", - -- "insert_file_link", - -- "search_headings", - -- "find_project_tasks", - -- "find_aof_project_tasks", - -- "find_aof_tasks", - -- "find_context_tasks", - "workspace", - -- "backlinks.file_backlinks", - -- "backlinks.header_backlinks", - }, -} -M.pickers = function() - local r = {} - for _, pic in ipairs(M.data.data.picker_names) do - local ht, te = pcall(require, "telescope._extensions.down.picker."..pic) - if ht then - r[pic] = te - end - r[pic] = require("telescope._extensions.down.picker."..pic) - end - return r -end -M.subscribed = { - cmd = { - ["integration.telescope.lsp"] = true, - ["integration.telescope.workspace"] = true, - ["integration.telescope.note"] = true, - ["integration.telescope"] = true, - ["integration.telescope.files"] = true, - ["integration.telescope.actions"] = true, - ["integration.telescope.commands"] = true, - ["integration.telescope.todo"] = true, - ["integration.telescope.linkable"] = true, - ["integration.telescope.link"] = true, - } -} -M.load = function() - Mod.await("cmd", function(cmd) - cmd.add_commands_from_table { - telescope = { - args = 0, - name = "integration.telescope", - subcommands = { - commands = { - name = "integration.telescope.commands", - args = 0, - - }, - actions = { - name = "integration.telescope.actions", - args = 0, - - }, - link = { - name = "integration.telescope.link", - args = 0, - - }, - todo = { - name = "integration.telescope.todo", - args = 0, - - }, - linkable = { - name = "integration.telescope.linkable", - args = 0, - - }, - files = { - name = "integration.telescope.files", - args = 0, - - }, - lsp = { - name = "integration.telescope.lsp", - args = 0, - - }, - note = { - name = "integration.telescope.note", - args = 0, - - }, - workspace = { - name = "integration.telescope.workspace", - args = 0, - - }, - - } - } - - } - end) - local hast, t = pcall(require, "telescope") - assert(hast, t) - t.load_extension("down") - for _, pic in ipairs(M.data.data.picker_names) do - -- t.load_extension(pic) - k("n", "down.telescope."..pic.."", M.pickers()[pic]) - end -end - -M.on = function(event) - if event.type == "integration.telescope" then - elseif event.type == "integration.telescope.link" then - vim.cmd [[Telescope down find_down]] - elseif event.type == "integration.telescope.workspace" then - vim.cmd [[Telescope down find_down]] - elseif event.type == "integration.telescope.actions" then - vim.cmd [[Telescope down find_down]] - elseif event.type == "integration.telescope.commands" then - vim.cmd [[Telescope down find_down]] - elseif event.type == "integration.telescope.todo" then - vim.cmd [[Telescope down find_down]] - elseif event.type == "integration.telescope.lsp" then - vim.cmd [[Telescope down find_down]] - elseif event.type == "integration.telescope.files" then - vim.cmd [[Telescope down find_down]] - require("telescope._extensions.down.picker.files")() - elseif event.type == "integration.telescope.workspace" then - vim.cmd [[Telescope down workspace]] - require("telescope._extensions.down.picker.workspace")() - end -end - -return M diff --git a/lua/down/mod/integration/trouble/init.lua b/lua/down/mod/integration/trouble/init.lua deleted file mode 100644 index 8cf03b4..0000000 --- a/lua/down/mod/integration/trouble/init.lua +++ /dev/null @@ -1,33 +0,0 @@ -local mod = require "down.mod" ----@alias down.integration.trouble.Trouble down.Mod -local T = mod.create("integration.trouble") -local tok, t = pcall(require, "trouble") - ----@class down.integration.trouble.Data -T.data = { - -} - -T.setup = function() - if not tok then return { - loadeed = false - } - else return { - loaded = true, - requires = { - "ui", - "ui.win", - "ui.popup" - } - } - end -end - ----@class down.integration.trouble.Config -T.config = { - -} - - - -return T diff --git a/lua/down/mod/lsp/completion/init.lua b/lua/down/mod/lsp/completion/init.lua index 404684e..42e2aaf 100644 --- a/lua/down/mod/lsp/completion/init.lua +++ b/lua/down/mod/lsp/completion/init.lua @@ -441,7 +441,7 @@ M.data = { }, --- Parses the public completion table and attempts to find all valid matches - ---@param context table #The context provided by the integration engine + ---@param context table #The context provided by the tool engine ---@param prev table? #The previous table of completions - used for descent ---@param saved string? #The saved regex in the form of a string, used to concatenate children nodes with parent nodes' regexes complete = function(context, prev, saved) @@ -486,7 +486,7 @@ M.data = { local ret_completions = { items = items, options = completion_data.options or {} } - -- Set the match variable for the integration M + -- Set the match variable for the tool M ret_completions.match = match -- If the completion data has a node variable then attempt to match the current node too! @@ -682,7 +682,7 @@ M.setup = function() loaded = true, requires = { "workspace", - "integration.treesitter", + "tool.treesitter", "edit.link", }, } @@ -946,21 +946,21 @@ M.load = function() and M.config.engine["mod_name"] then local completion_mod = M.config.engine == "nvim-compe" - and Mod.load_mod("core.integrations.nvim-compe") - mod.load_mod_as_dependency("core.integrations.nvim-compe", M.name, {}) - M.data.engine = mod.get_mod("core.integrations.nvim-compe") + and Mod.load_mod("core.tools.nvim-compe") + mod.load_mod_as_dependency("core.tools.nvim-compe", M.name, {}) + M.data.engine = mod.get_mod("core.tools.nvim-compe") elseif M.config.engine == "nvim-cmp" - and mod.load_mod("core.integrations.nvim-cmp") + and mod.load_mod("core.tools.nvim-cmp") then - mod.load_mod_as_dependency("core.integrations.nvim-cmp", M.name, {}) - M.data.engine = mod.get_mod("core.integrations.nvim-cmp") + mod.load_mod_as_dependency("core.tools.nvim-cmp", M.name, {}) + M.data.engine = mod.get_mod("core.tools.nvim-cmp") elseif M.config.engine == "coq_nvim" - and mod.load_mod("core.integrations.coq_nvim") + and mod.load_mod("core.tools.coq_nvim") then - mod.load_mod_as_dependency("core.integrations.coq_nvim", M.name, {}) - M.data.engine = mod.get_mod("core.integrations.coq_nvim") + mod.load_mod_as_dependency("core.tools.coq_nvim", M.name, {}) + M.data.engine = mod.get_mod("core.tools.coq_nvim") else log.error( "Unable to load completion M -", @@ -973,18 +973,18 @@ M.load = function() dirutils = M.required["core.dirman.utils"] dirman = M.required["core.dirman"] link_utils = M.required["core.links"] - treesitter = M.required["core.integrations.treesitter"] + treesitter = M.required["core.tools.treesitter"] - -- Set a special function in the integration M to allow it to communicate with us + -- Set a special function in the tool M to allow it to communicate with us M.data.engine.invoke_completion_engine = function(context) ---@diagnostic disable-line return M.data.complete(context) ---@diagnostic disable-line -- TODO: type error workaround end - -- Create the integration engine's source + -- Create the tool engine's source M.data.engine.create_source({ completions = M.config.completions, }) - -- ts = mod.required["integration.treesitter"] + -- ts = mod.required["tool.treesitter"] end M.data = { diff --git a/lua/down/mod/lsp/document/format/init.lua b/lua/down/mod/lsp/document/format/init.lua index 223cdbd..3332249 100644 --- a/lua/down/mod/lsp/document/format/init.lua +++ b/lua/down/mod/lsp/document/format/init.lua @@ -9,7 +9,7 @@ M.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", "workspace", }, } @@ -55,7 +55,7 @@ local workspace, workspace, ts M.load = function() -- TODO: how would I get types in here? ---@type treesitter - ts = M.required["integration.treesitter"] + ts = M.required["tool.treesitter"] workspace = M.required["workspace"] end diff --git a/lua/down/mod/lsp/init.lua b/lua/down/mod/lsp/init.lua index 608bec8..9e01e67 100644 --- a/lua/down/mod/lsp/init.lua +++ b/lua/down/mod/lsp/init.lua @@ -67,7 +67,7 @@ M.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", "data", "workspace", "cmd", @@ -320,7 +320,7 @@ M.load = function() callback = M.data.start_lsp, }) end -M.data.ts = Mod.get_mod("integration.treesitter") +M.data.ts = Mod.get_mod("tool.treesitter") M.data.workspace_file = Mod.get_mod("lsp.workspace.file") M.data.workspace = Mod.get_mod("workspace") M.data.lsp_ws = Mod.get_mod("lsp.workspace") diff --git a/lua/down/mod/lsp/refactor/init.lua b/lua/down/mod/lsp/refactor/init.lua index bba31d1..227a2e1 100644 --- a/lua/down/mod/lsp/refactor/init.lua +++ b/lua/down/mod/lsp/refactor/init.lua @@ -9,7 +9,7 @@ M.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", "workspace", }, } @@ -17,7 +17,7 @@ end local workspace, ts M.load = function() - -- ts = M.required["integration.treesitter"] + -- ts = M.required["tool.treesitter"] -- workspace = M.required["workspace"] end diff --git a/lua/down/mod/note/init.lua b/lua/down/mod/note/init.lua index c4717b4..cd7e467 100644 --- a/lua/down/mod/note/init.lua +++ b/lua/down/mod/note/init.lua @@ -840,7 +840,7 @@ M.setup = function() "data", "data.template", "workspace", - "integration.treesitter", + "tool.treesitter", }, } end diff --git a/lua/down/mod/integration/fzf/README.md b/lua/down/mod/tool/README.md similarity index 100% rename from lua/down/mod/integration/fzf/README.md rename to lua/down/mod/tool/README.md diff --git a/lua/down/mod/integration/lualine/README.md b/lua/down/mod/tool/blink/README.md similarity index 100% rename from lua/down/mod/integration/lualine/README.md rename to lua/down/mod/tool/blink/README.md diff --git a/lua/down/mod/integration/blink/format.lua b/lua/down/mod/tool/blink/format.lua similarity index 100% rename from lua/down/mod/integration/blink/format.lua rename to lua/down/mod/tool/blink/format.lua diff --git a/lua/down/mod/tool/blink/init.lua b/lua/down/mod/tool/blink/init.lua new file mode 100644 index 0000000..ac6f0b3 --- /dev/null +++ b/lua/down/mod/tool/blink/init.lua @@ -0,0 +1,15 @@ +local mod = require("down.mod") + +---@type down.Mod +local M = mod.create("tool.blink") + +local has_blink, blink = pcall(require, "blink.cmp") + +---@class down.tool.blink.Config +M.config = {} +---@class down.tool.blink.Data +M.data = {} +M.data.source = require("down.mod.tool.blink.source") +M.data.format = require("down.mod.tool.blink.format") + +return M diff --git a/lua/down/mod/integration/blink/source/file.lua b/lua/down/mod/tool/blink/source/file.lua similarity index 85% rename from lua/down/mod/integration/blink/source/file.lua rename to lua/down/mod/tool/blink/source/file.lua index 502be5d..f62c7da 100644 --- a/lua/down/mod/integration/blink/source/file.lua +++ b/lua/down/mod/tool/blink/source/file.lua @@ -1,4 +1,4 @@ ----@class down.mod.integration.blink.source.FileOptions +---@class down.mod.tool.blink.source.FileOptions ---@field pre_min_len? number: min ---@field public cmd? fun(ctx: blink.cmp.Context, pre: string): string[] ---@field public pre? fun(ctx: blink.cmp.Context): string[] @@ -7,9 +7,9 @@ local vim = require("vim") local Fs = {} ---@return blink.cmp.Source ----@param opt down.mod.integration.blink.source.FileOptions +---@param opt down.mod.tool.blink.source.FileOptions function Fs:new(opt) - ---@type down.mod.integration.blink.source.FileOptions + ---@type down.mod.tool.blink.source.FileOptions opt = opt or {} return setmetatable({ pre_min_len = opt.pre_min_len or 3, diff --git a/lua/down/mod/integration/blink/source/init.lua b/lua/down/mod/tool/blink/source/init.lua similarity index 100% rename from lua/down/mod/integration/blink/source/init.lua rename to lua/down/mod/tool/blink/source/init.lua diff --git a/lua/down/mod/integration/telescope/README.md b/lua/down/mod/tool/cmp/README.md similarity index 100% rename from lua/down/mod/integration/telescope/README.md rename to lua/down/mod/tool/cmp/README.md diff --git a/lua/down/mod/integration/cmp/init.lua b/lua/down/mod/tool/cmp/init.lua similarity index 60% rename from lua/down/mod/integration/cmp/init.lua rename to lua/down/mod/tool/cmp/init.lua index b4a4e9a..c5d03cb 100644 --- a/lua/down/mod/integration/cmp/init.lua +++ b/lua/down/mod/tool/cmp/init.lua @@ -1,14 +1,14 @@ local mod = require "down.mod" -local M = mod.create("integration.cmp") +local M = mod.create("tool.cmp") local has_cmp, cmp = pcall(require, "cmp") ----@class down.integration.cmp.Data +---@class down.tool.cmp.Data M.data = { } ----@class down.integration.cmp.Config +---@class down.tool.cmp.Config M.config = { } diff --git a/lua/down/mod/integration/treesitter/README.md b/lua/down/mod/tool/coq/README.md similarity index 100% rename from lua/down/mod/integration/treesitter/README.md rename to lua/down/mod/tool/coq/README.md diff --git a/lua/down/mod/integration/trouble/README.md b/lua/down/mod/tool/coq/init.lua similarity index 100% rename from lua/down/mod/integration/trouble/README.md rename to lua/down/mod/tool/coq/init.lua diff --git a/lua/down/mod/tool/dcmp/init.lua b/lua/down/mod/tool/dcmp/init.lua new file mode 100644 index 0000000..e351df1 --- /dev/null +++ b/lua/down/mod/tool/dcmp/init.lua @@ -0,0 +1,7 @@ +--- bold native completion attempt as side proj + +local mod = require("word.mod") + +local M = mod.create("tool.dcmp") + +return M diff --git a/lua/down/mod/tool/fzf/README.md b/lua/down/mod/tool/fzf/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lua/down/mod/integration/fzf/init.lua b/lua/down/mod/tool/fzf/init.lua similarity index 60% rename from lua/down/mod/integration/fzf/init.lua rename to lua/down/mod/tool/fzf/init.lua index 2ad86e8..12a268e 100644 --- a/lua/down/mod/integration/fzf/init.lua +++ b/lua/down/mod/tool/fzf/init.lua @@ -1,6 +1,6 @@ local mod = require("down.mod") ---@type down.Mod -local F = mod.create("integration.fzf") +local F = mod.create("tool.fzf") return F diff --git a/lua/down/mod/integration/init.lua b/lua/down/mod/tool/init.lua similarity index 59% rename from lua/down/mod/integration/init.lua rename to lua/down/mod/tool/init.lua index cc7fcae..b9b47b2 100644 --- a/lua/down/mod/integration/init.lua +++ b/lua/down/mod/tool/init.lua @@ -1,22 +1,22 @@ ---TODO: imelement -local E = require('down.mod').create('integration') +local E = require('down.mod').create('tool') ---TODO: implement config to initialize sub integrations depending on user config +--TODO: implement config to initialize sub tools depending on user config ----@class down.integration.Config +---@class down.tool.Config E.config = { - ---@brief List of integrations to disable (relative to the integration dir) + ---@brief List of tools to disable (relative to the tool dir) disabled = { }, - ---@brief List of integrations to enable (relative to the integration dir) + ---@brief List of tools to enable (relative to the tool dir) enabled = { "telescope", "treesitter", } } ----@class down.integration.Data +---@class down.tool.Data E.data = { } @@ -29,7 +29,7 @@ end ---TODO: implement ---Returns either a table of the loaded dependencies or nil of one is unsuccessful ---@return table|nil: the loaded dependency package ----@param ext string: the integration module to check +---@param ext string: the tool module to check E.data.deps = function(ext) return nil end @@ -42,9 +42,9 @@ E.data.has = function(ext) return pcall(require, ext) end ---- Generic setup function for integration submodules ---- @param ext string: the integration to setup ---- @param req table: the modules required by the integration module +--- Generic setup function for tool submodules +--- @param ext string: the tool to setup +--- @param req table: the modules required by the tool module --- @return down.mod.Setup E.data.setup = function(ext, req) local ok, e = E.data.has(ext) diff --git a/lua/down/mod/tool/lualine/README.md b/lua/down/mod/tool/lualine/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lua/down/mod/tool/lualine/init.lua b/lua/down/mod/tool/lualine/init.lua new file mode 100644 index 0000000..4e622d8 --- /dev/null +++ b/lua/down/mod/tool/lualine/init.lua @@ -0,0 +1,16 @@ +local mod = require("down.mod") +---@type down.Mod +local L = mod.create("tool.lualine") + +L.setup = function() + return { + loaded = true, + } +end + +---@class word.tool.lualine.Config +L.config = {} +---@class word.tool.lualine.Data +L.data = {} + +return L diff --git a/lua/down/mod/tool/pandoc/README.md b/lua/down/mod/tool/pandoc/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lua/down/mod/tool/pandoc/init.lua b/lua/down/mod/tool/pandoc/init.lua new file mode 100644 index 0000000..62ca420 --- /dev/null +++ b/lua/down/mod/tool/pandoc/init.lua @@ -0,0 +1,15 @@ +local P = {} + +P.setup = function() + return { + loaded = true, + } +end + +---@class word.tool.pandoc.Data +P.data = {} + +---@class word.tool.pandoc.Config +P.config = {} + +return P diff --git a/lua/down/mod/tool/telescope/README.md b/lua/down/mod/tool/telescope/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lua/down/mod/integration/telescope/init.lua b/lua/down/mod/tool/telescope/init.lua similarity index 76% rename from lua/down/mod/integration/telescope/init.lua rename to lua/down/mod/tool/telescope/init.lua index 5e0d630..324a8c4 100644 --- a/lua/down/mod/integration/telescope/init.lua +++ b/lua/down/mod/tool/telescope/init.lua @@ -1,5 +1,5 @@ local mod = require("down.mod") -local M = mod.create("integration.telescope") +local M = mod.create("tool.telescope") local tok, t = pcall(require, "telescope") local k = vim.keymap.set @@ -17,7 +17,7 @@ M.setup = function() end end ----@class down.integration.telescope.Data +---@class down.tool.telescope.Data M.data = { picker_names = { "linkable", @@ -34,7 +34,7 @@ M.data = { -- "backlinks.header_backlinks", }, } ----@class down.integration.telescope.Config +---@class down.tool.telescope.Config M.config = {} M.data.pickers = function() local r = {} @@ -49,8 +49,8 @@ M.data.pickers = function() end M.subscribed = { cmd = { - ["integration.telescope.find.files"] = true, - ["integration.telescope.find.workspace"] = true, + ["tool.telescope.find.files"] = true, + ["tool.telescope.find.workspace"] = true, }, } M.load = function() @@ -59,14 +59,14 @@ M.load = function() cmd.add_commands_from_table({ find = { args = 0, - name = "integration.telescope.find", + name = "tool.telescope.find", subcommands = { files = { - name = "integration.telescope.find.files", + name = "tool.telescope.find.files", args = 0, }, workspace = { - name = "integration.telescope.find.workspace", + name = "tool.telescope.find.workspace", args = 0, }, }, @@ -85,9 +85,9 @@ M.load = function() end M.on = function(event) - if event.type == "integration.telescope.find.files" then + if event.type == "tool.telescope.find.files" then vim.cmd([[Telescope down find_down]]) - elseif event.type == "integration.telescope.find.workspace" then + elseif event.type == "tool.telescope.find.workspace" then vim.cmd([[Telescope down workspace]]) require("telescope._extensions.down.picker.workspace")() end diff --git a/lua/down/mod/tool/telescope/new.lua b/lua/down/mod/tool/telescope/new.lua new file mode 100644 index 0000000..c54f444 --- /dev/null +++ b/lua/down/mod/tool/telescope/new.lua @@ -0,0 +1,137 @@ +local mod = require("word.mod") +local M = mod.create("tool.telescope") +local k = vim.keymap.set + +M.setup = function() + return { + loaded = true, + requires = { "cmd", "workspace" }, + } +end + +M.data.data = { + picker_names = { + "linkable", + "lsp", + "link", + "todo", + "actions", + "note", + "files", + -- "insert_link", + -- "insert_file_link", + -- "search_headings", + -- "find_project_tasks", + -- "find_aof_project_tasks", + -- "find_aof_tasks", + -- "find_context_tasks", + "workspace", + -- "backlinks.file_backlinks", + -- "backlinks.header_backlinks", + }, +} +M.pickers = function() + local r = {} + for _, pic in ipairs(M.data.data.picker_names) do + local ht, te = pcall(require, "telescope._extensions.down.picker." .. pic) + if ht then + r[pic] = te + end + r[pic] = require("telescope._extensions.down.picker." .. pic) + end + return r +end +M.subscribed = { + cmd = { + ["tool.telescope.lsp"] = true, + ["tool.telescope.workspace"] = true, + ["tool.telescope.note"] = true, + ["tool.telescope"] = true, + ["tool.telescope.files"] = true, + ["tool.telescope.actions"] = true, + ["tool.telescope.commands"] = true, + ["tool.telescope.todo"] = true, + ["tool.telescope.linkable"] = true, + ["tool.telescope.link"] = true, + }, +} +M.load = function() + Mod.await("cmd", function(cmd) + cmd.add_commands_from_table({ + telescope = { + args = 0, + name = "tool.telescope", + subcommands = { + commands = { + name = "tool.telescope.commands", + args = 0, + }, + actions = { + name = "tool.telescope.actions", + args = 0, + }, + link = { + name = "tool.telescope.link", + args = 0, + }, + todo = { + name = "tool.telescope.todo", + args = 0, + }, + linkable = { + name = "tool.telescope.linkable", + args = 0, + }, + files = { + name = "tool.telescope.files", + args = 0, + }, + lsp = { + name = "tool.telescope.lsp", + args = 0, + }, + note = { + name = "tool.telescope.note", + args = 0, + }, + workspace = { + name = "tool.telescope.workspace", + args = 0, + }, + }, + }, + }) + end) + local hast, t = pcall(require, "telescope") + assert(hast, t) + t.load_extension("down") + for _, pic in ipairs(M.data.data.picker_names) do + -- t.load_extension(pic) + k("n", "down.telescope." .. pic .. "", M.pickers()[pic]) + end +end + +M.on = function(event) + if event.type == "tool.telescope" then + elseif event.type == "tool.telescope.link" then + vim.cmd([[Telescope down find_down]]) + elseif event.type == "tool.telescope.workspace" then + vim.cmd([[Telescope down find_down]]) + elseif event.type == "tool.telescope.actions" then + vim.cmd([[Telescope down find_down]]) + elseif event.type == "tool.telescope.commands" then + vim.cmd([[Telescope down find_down]]) + elseif event.type == "tool.telescope.todo" then + vim.cmd([[Telescope down find_down]]) + elseif event.type == "tool.telescope.lsp" then + vim.cmd([[Telescope down find_down]]) + elseif event.type == "tool.telescope.files" then + vim.cmd([[Telescope down find_down]]) + require("telescope._extensions.down.picker.files")() + elseif event.type == "tool.telescope.workspace" then + vim.cmd([[Telescope down workspace]]) + require("telescope._extensions.down.picker.workspace")() + end +end + +return M diff --git a/lua/down/mod/tool/treesitter/README.md b/lua/down/mod/tool/treesitter/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lua/down/mod/integration/treesitter/init.lua b/lua/down/mod/tool/treesitter/init.lua similarity index 99% rename from lua/down/mod/integration/treesitter/init.lua rename to lua/down/mod/tool/treesitter/init.lua index 05470ee..76d3677 100644 --- a/lua/down/mod/integration/treesitter/init.lua +++ b/lua/down/mod/tool/treesitter/init.lua @@ -8,9 +8,9 @@ local u = require("nvim-treesitter.utils") local loc = require("nvim-treesitter.locals") local tsu = require("nvim-treesitter.ts_utils") -local M = mod.create("integration.treesitter") +local M = mod.create("tool.treesitter") ----@class down.integration.treesitter.Data +---@class down.tool.treesitter.Data M.data = { ts_utils = nil, heading = [[ @@ -1043,7 +1043,7 @@ end M.subscribed = { cmd = { - ['integration.treesitter'] = true, + ['tool.treesitter'] = true, }, } diff --git a/lua/down/mod/tool/trouble/README.md b/lua/down/mod/tool/trouble/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lua/down/mod/tool/trouble/init.lua b/lua/down/mod/tool/trouble/init.lua new file mode 100644 index 0000000..6058752 --- /dev/null +++ b/lua/down/mod/tool/trouble/init.lua @@ -0,0 +1,30 @@ +local mod = require("down.mod") +---@alias down.tool.trouble.Trouble down.Mod +local T = mod.create("tool.trouble") + +local t_ok, trouble = pcall(require, "trouble") + +T.setup = function() + if t_ok ~= true then + return { + loadeed = false, + } + else + return { + loaded = true, + requires = { + "ui", + "ui.win", + "ui.popup", + }, + } + end +end + +---@class down.tool.trouble.Data +T.data = {} + +---@class down.tool.trouble.Config +T.config = {} + +return T diff --git a/lua/down/mod/tool/trouble/util.lua b/lua/down/mod/tool/trouble/util.lua new file mode 100644 index 0000000..c3c1750 --- /dev/null +++ b/lua/down/mod/tool/trouble/util.lua @@ -0,0 +1,11 @@ +local mod = require("word.mod") + +local M = mod.create("tool.trouble") + +local tro_ok, tro = pcall(require, "trouble") + +---@return +function M.has_trouble() + if tro_ok then return tro + else return nil +end diff --git a/lua/down/mod/ui/icon/init.lua b/lua/down/mod/ui/icon/init.lua index 938f2be..96ac5f0 100644 --- a/lua/down/mod/ui/icon/init.lua +++ b/lua/down/mod/ui/icon/init.lua @@ -12,7 +12,7 @@ M.setup = function() return { loaded = true, requires = { - "integration.treesitter", + "tool.treesitter", }, } end @@ -1151,7 +1151,7 @@ local function prettify_range(bufid, row_start_0b, row_end_0bex) -- TODO: optimize row_end_0bex = math.min(row_end_0bex + 1, vim.api.nvim_buf_line_count(bufid)) - local tsm = M.required["integration.treesitter"] + local tsm = M.required["tool.treesitter"] local document_root = tsm.get_document_root(bufid) assert(document_root) diff --git a/lua/down/mod/ui/notify/init.lua b/lua/down/mod/ui/notify/init.lua new file mode 100644 index 0000000..2c0725d --- /dev/null +++ b/lua/down/mod/ui/notify/init.lua @@ -0,0 +1,3 @@ +local N = require "word.mod".create("ui.notify") + +return N diff --git a/lua/down/mod/ui/vtext/init.lua b/lua/down/mod/ui/vtext/init.lua new file mode 100644 index 0000000..7e65dd7 --- /dev/null +++ b/lua/down/mod/ui/vtext/init.lua @@ -0,0 +1,3 @@ +local V = require "word.mod".create("ui.vtext") + +return V diff --git a/lua/down/types.lua b/lua/down/types.lua index a1d0318..6970f56 100644 --- a/lua/down/types.lua +++ b/lua/down/types.lua @@ -2,7 +2,7 @@ --- --- @alias down.mod.Data { [any]: any } ---- @class (exact) down.mod.Mods +--- @class down.mod.Mods --- @field ['lsp.document']? lsp.document.Data --- @field ['lsp.workspace']? lsp.workspace.Data --- @field ['lsp.completion']? lsp.completion.Data @@ -66,7 +66,7 @@ --- Public configs may be tweaked by the user from the `down.setup()` function, whereas private configs are for internal use only. --- @alias down.mod.Config table ---- @class (exact) down.mod.Events +--- @class down.mod.Events --- @field defined? { [string]: down.Event } Lists all events by this init. --- @field subscribed? { [string]: { [string]: boolean } } Lists the events that the init is subscribed to. @@ -75,7 +75,7 @@ --- Defines a init. --- A init is an object that contains a set of hooks which are invoked by down whenever something in the --- environment occurs. This can be an event, a simple act of the init being loaded or anything else. ---- @class (exact) down.Mod +--- @class down.Mod --- @field hook? fun(manual: boolean, arguments?: string) A user-defined function that is invoked whenever down starts up. May be used to e.g. set custom keybindings. --- @field config? down.mod.Config The config for the init. --- @field events? down.mod.Events Describes all information related to events for this init.