Skip to content

Commit

Permalink
feat: remove old todos
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Oct 21, 2024
1 parent d3b0642 commit a47b3f8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 36 deletions.
50 changes: 24 additions & 26 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
title: Design
description: Design of care.nvim
author:
- max397574
- max397574
categories:
- docs
- docs
---

# General
Expand All @@ -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

Expand All @@ -43,8 +43,6 @@ beginning of the line.

# Architecture

TODO: fancy ascii diagramms

autocompletion:

1. `TextChangedI` or `CursorMovedI`
Expand All @@ -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. `<cr>`):

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
Expand Down
2 changes: 0 additions & 2 deletions lua/care/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lua/care/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ local function map(plug, callback)
end

function mappings.setup()
-- TODO: perhaps add more
map("<Plug>(CareConfirm)", function()
require("care").api.confirm()
end)
Expand Down
2 changes: 0 additions & 2 deletions lua/care/matcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions lua/care/menu/confirm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion lua/care/menu/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion lua/care/sources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a47b3f8

Please sign in to comment.