diff --git a/docs/design.md b/docs/design.md index e27deef..c566c6d 100644 --- a/docs/design.md +++ b/docs/design.md @@ -2,9 +2,9 @@ title: Design description: Design of care.nvim author: - - max397574 + - max397574 categories: - - docs + - docs --- # General @@ -23,16 +23,16 @@ completions which are then displayed in the [Completion Menu](#completion-menu) The completion menu displays the current completions. Features that it should have: -- Completely customizable display for every entry (with **text-highlight - chunks** like extmark-api) -- Customizable scrollbar -- Customizable window properties - - Border - - Max height -- Docview - - Customizable - - Try to get nicely concealed like in core or noice.nvim - - Allow to send to e.g. quickfix or copy +- Completely customizable display for every entry (with **text-highlight + chunks** like extmark-api) +- Customizable scrollbar +- Customizable window properties + - Border + - Max height +- Docview + - Customizable + - Try to get nicely concealed like in core or noice.nvim + - Allow to send to e.g. quickfix or copy # Terms @@ -43,8 +43,6 @@ beginning of the line. # Architecture -TODO: fancy ascii diagramms - autocompletion: 1. `TextChangedI` or `CursorMovedI` @@ -53,26 +51,26 @@ autocompletion: 4. Check if character was a trigger character or completion was triggered manually 5. Depending on ^^ decide what to do _for every source_: - - Get new completions - 1. get completions from source based on context - - sort completions - 1. Use characters found with `keyword_pattern` to fuzzy match and sort - completions + - Get new completions + 1. get completions from source based on context + - sort completions + 1. Use characters found with `keyword_pattern` to fuzzy match and sort + completions 6. Collect all the completions 7. Open menu to display thing - 1. if there is a selected one: - - highlight selected one - - show preview of selected completion - - show docs + 1. if there is a selected one: + - highlight selected one + - show preview of selected completion + - show docs When completing (e.g. ``): 1. check if menu is open 2. check if anything is selected (or autoselect option) 3. complete - 1. insert text - 2. additional text edits (check core functions) - 3. snippet expansion (core or luasnip) + 1. insert text + 2. additional text edits (check core functions) + 3. snippet expansion (core or luasnip) 4. close menu # Motivation diff --git a/lua/care/highlights.lua b/lua/care/highlights.lua index 13ce540..93d2fea 100644 --- a/lua/care/highlights.lua +++ b/lua/care/highlights.lua @@ -5,8 +5,6 @@ @care.match: Matched part of entries --]] --- TODO: move into function? - --- Gets red, green and blue values for color ---@param color string @#RRGGBB ---@return table diff --git a/lua/care/mappings.lua b/lua/care/mappings.lua index de58631..09fc065 100644 --- a/lua/care/mappings.lua +++ b/lua/care/mappings.lua @@ -21,7 +21,6 @@ local function map(plug, callback) end function mappings.setup() - -- TODO: perhaps add more map("(CareConfirm)", function() require("care").api.confirm() end) diff --git a/lua/care/matcher.lua b/lua/care/matcher.lua index ac9aead..18debc5 100644 --- a/lua/care/matcher.lua +++ b/lua/care/matcher.lua @@ -9,8 +9,6 @@ local Matcher = {} function Matcher.match(entries, prefix) ---@param entry care.entry local function get_filter_text(entry) - -- TODO: makes more sense like this because label is what user sees? - -- return entry.filterText or entry.label return entry.completion_item.label end diff --git a/lua/care/menu/confirm.lua b/lua/care/menu/confirm.lua index d1138f1..6dddd96 100644 --- a/lua/care/menu/confirm.lua +++ b/lua/care/menu/confirm.lua @@ -2,8 +2,6 @@ ---@return lsp.CompletionItem local function normalize_entry(entry) entry.insertTextFormat = entry.insertTextFormat or 1 - -- TODO: make this earlier because the sorting won't happen here - -- TODO: perhaps remove? are these fields even relevant to complete? entry.filterText = entry.filterText or entry.label entry.sortText = entry.sortText or entry.label entry.insertText = entry.insertText or entry.label @@ -78,7 +76,6 @@ return function(entry) vim.api.nvim_win_set_cursor(0, { start.line + 1, start.character }) config.snippet_expansion(snippet_text) else - -- TODO: revert when https://github.com/neovim/neovim/issues/29811 if fixed local text_edit_lines = vim.split(completion_item.textEdit.newText, "\n") vim.api.nvim_win_set_cursor(0, { start.line + #text_edit_lines, diff --git a/lua/care/menu/init.lua b/lua/care/menu/init.lua index 70ee392..26624ba 100644 --- a/lua/care/menu/init.lua +++ b/lua/care/menu/init.lua @@ -276,7 +276,6 @@ function Menu:get_active_entry() if not self.entries then return nil end - -- TODO: make 0->1 configurable (cmpts "autoselect") if self.reversed then if self.index == 0 then return self.entries[1] diff --git a/lua/care/sources.lua b/lua/care/sources.lua index c3c5c07..b5f16b6 100644 --- a/lua/care/sources.lua +++ b/lua/care/sources.lua @@ -36,7 +36,6 @@ function care_sources.complete(context, source, callback) end return elseif not source.entries or #source.entries == 0 then - -- TODO: perhaps different trigger kind because we're manually requesting completions here? completion_context = { triggerKind = 2, triggerCharacter = last_char,