summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfdschmidt93 <39233597+fdschmidt93@users.noreply.github.com>2022-05-09 11:43:22 +0200
committerGitHub <noreply@github.com>2022-05-09 11:43:22 +0200
commit795a63ed293ba249a588e9e67aa1f2cec82028e8 (patch)
tree66f6660a1d5d0031ad6e0a84258604bb43254926
parent85239d9c3e0f0eaa728eb2369ef66c4a79fd997b (diff)
feat(docs): simplified architecture flow chart (#1925)
`:h telescope.nvim` now shows an overview of the telescope architecture
-rw-r--r--developers.md9
-rw-r--r--doc/telescope.txt47
-rw-r--r--lua/telescope/init.lua50
3 files changed, 101 insertions, 5 deletions
diff --git a/developers.md b/developers.md
index 748c5c0..26e2b30 100644
--- a/developers.md
+++ b/developers.md
@@ -20,9 +20,12 @@
So you want to develop your own picker and/or extension for telescope? Then you
are in the right place! This file will first present an introduction on how to
do this. After that, this document will present a technical explanation of
-pickers, finders, actions and the previewer. You can find more information
-in specific help pages and we will probably move some of the technical stuff to
-our vim help docs in the future.
+pickers, finders, actions and the previewer. Should you now yet have an idea of
+the general telescope architecture and its components, it is first recommend to
+familiarize yourself with the architectural flow-chart that is provided in
+vim docs (`:h telescope.nvim`). You can find more information in specific help
+pages and we will probably move some of the technical stuff to our vim help docs
+in the future.
This guide is mainly for telescope so it will assume that you already have some knowledge of the Lua
programming language. If not then you can find information for Lua here:
diff --git a/doc/telescope.txt b/doc/telescope.txt
index b1730c5..2a6b31c 100644
--- a/doc/telescope.txt
+++ b/doc/telescope.txt
@@ -15,6 +15,51 @@ Getting started with telescope:
what options these implement
6. Profit
+The below flow chart illustrates a simplified telescope architecture:
+┌───────────────────────────────────────────────────────────┐
+│ ┌────────┐ │
+│ │ Multi │ ┌───────+ │
+│ │ Select │ ┌───────┐ │ Entry │ │
+│ └─────┬──* │ Entry │ ┌────────+ │ Maker │ │
+│ │ ┌───│Manager│────│ Sorter │┐ └───┬───* │
+│ ▼ ▼ └───────* └────────┘│ │ │
+│ 1────────┐ 2───┴──┐ │ │
+│ ┌─────│ Picker │ │Finder│◄────┘ │
+│ ▼ └───┬────┘ └──────* │
+│ ┌────────┐ │ 3────────+ ▲ │
+│ │Selected│ └───────│ Prompt │─────────┘ │
+│ │ Entry │ └───┬────┘ │
+│ └────────* ┌───┴────┐ ┌────────┐ ┌────────┐ │
+│ │ ▲ 4─────────┐│ Prompt │ │(Attach)│ │Actions │ │
+│ ▼ └──► │ Results ││ Buffer │◄─┤Mappings│◄─┤User Fn │ │
+│5─────────┐ └─────────┘└────────┘ └────────┘ └────────┘ │
+││Previewer│ │
+│└─────────┘ telescope.nvim architecture │
+└───────────────────────────────────────────────────────────┘
+
+ + The `Entry Maker` at least defines
+ - value: "raw" result of the finder
+ - ordinal: string to be sorted derived from value
+ - display: line representation of entry in results buffer
+
+ * The finder, entry manager, selected entry, and multi selections
+ comprises `entries` constructed by the `Entry Maker` from
+ raw results of the finder (`value`s)
+
+ Primary components:
+ 1 Picker: central UI dedicated to varying use cases
+ (finding files, grepping, diagnostics, etc.)
+ see :h telescope.builtin
+ 2 Finder: pipe or interactively generates results to pick over
+ 3 Prompt: user input that triggers the finder which sorts results
+ in order into the entry manager
+ 4 Results: listed entries scored by sorter from finder results
+ 5 Previewer: preview of context of selected entry
+ see :h telescope.previewers
+
+A practical introduction into telescope customization is our `developers.md`
+(top-level of repo) and `:h telescope.actions` that showcase how to access
+information about the state of the picker (current selection, etc.).
To find out more:
https://github.com/nvim-telescope/telescope.nvim
@@ -29,8 +74,8 @@ https://github.com/nvim-telescope/telescope.nvim
:h telescope.actions.set
:h telescope.actions.utils
:h telescope.actions.generate
- :h telescope.previewers
:h telescope.actions.history
+ :h telescope.previewers
telescope.setup({opts}) *telescope.setup()*
Setup function to be run by user. Configures the defaults, pickers and
diff --git a/lua/telescope/init.lua b/lua/telescope/init.lua
index 35577a8..0cc2009 100644
--- a/lua/telescope/init.lua
+++ b/lua/telescope/init.lua
@@ -21,6 +21,54 @@ local telescope = {}
--- 5. Read |telescope.builtin| to check which builtin pickers are offered and what options these implement
--- 6. Profit
---
+--- The below flow chart illustrates a simplified telescope architecture:
+--- <pre>
+--- ┌───────────────────────────────────────────────────────────┐
+--- │ ┌────────┐ │
+--- │ │ Multi │ ┌───────+ │
+--- │ │ Select │ ┌───────┐ │ Entry │ │
+--- │ └─────┬──* │ Entry │ ┌────────+ │ Maker │ │
+--- │ │ ┌───│Manager│────│ Sorter │┐ └───┬───* │
+--- │ ▼ ▼ └───────* └────────┘│ │ │
+--- │ 1────────┐ 2───┴──┐ │ │
+--- │ ┌─────│ Picker │ │Finder│◄────┘ │
+--- │ ▼ └───┬────┘ └──────* │
+--- │ ┌────────┐ │ 3────────+ ▲ │
+--- │ │Selected│ └───────│ Prompt │─────────┘ │
+--- │ │ Entry │ └───┬────┘ │
+--- │ └────────* ┌───┴────┐ ┌────────┐ ┌────────┐ │
+--- │ │ ▲ 4─────────┐│ Prompt │ │(Attach)│ │Actions │ │
+--- │ ▼ └──► │ Results ││ Buffer │◄─┤Mappings│◄─┤User Fn │ │
+--- │5─────────┐ └─────────┘└────────┘ └────────┘ └────────┘ │
+--- ││Previewer│ │
+--- │└─────────┘ telescope.nvim architecture │
+--- └───────────────────────────────────────────────────────────┘
+---
+--- + The `Entry Maker` at least defines
+--- - value: "raw" result of the finder
+--- - ordinal: string to be sorted derived from value
+--- - display: line representation of entry in results buffer
+---
+--- * The finder, entry manager, selected entry, and multi selections
+--- comprises `entries` constructed by the `Entry Maker` from
+--- raw results of the finder (`value`s)
+---
+--- Primary components:
+--- 1 Picker: central UI dedicated to varying use cases
+--- (finding files, grepping, diagnostics, etc.)
+--- see :h telescope.builtin
+--- 2 Finder: pipe or interactively generates results to pick over
+--- 3 Prompt: user input that triggers the finder which sorts results
+--- in order into the entry manager
+--- 4 Results: listed entries scored by sorter from finder results
+--- 5 Previewer: preview of context of selected entry
+--- see :h telescope.previewers
+--- </pre>
+---
+--- A practical introduction into telescope customization is our
+--- `developers.md` (top-level of repo) and `:h telescope.actions` that
+--- showcase how to access information about the state of the picker (current
+--- selection, etc.).
--- <pre>
--- To find out more:
--- https://github.com/nvim-telescope/telescope.nvim
@@ -36,8 +84,8 @@ local telescope = {}
--- :h telescope.actions.set
--- :h telescope.actions.utils
--- :h telescope.actions.generate
---- :h telescope.previewers
--- :h telescope.actions.history
+--- :h telescope.previewers
--- </pre>
---@brief ]]