summaryrefslogtreecommitdiff
path: root/src/insert_completer.hh
AgeCommit message (Collapse)Author
2024-09-02Explicitely call try_accept on InsertCompleterMaxime Coste
Calling it as part of the insert method was error prone and often led to slightly surprising behaviour, such as the <c-r><esc> hiding the menu on <esc>.
2024-07-22Handle word completion when recording macrosMaxime Coste
Make last insert and macro recording closer together, paving the way towards moving last insert to a register. Use a FunctionRef for insert completer key insertion support.
2024-03-23Refactor last insert recording logicMaxime Coste
Only record non-synthetized insertions, removing the need to re-record on replay and fixing the last replay getting dropped by macro execution. Fixes #5122
2023-10-25Default comparison operators that can beMaxime Coste
2023-10-25Remove redundant comparison operatorsMaxime Coste
Since C++20 (a != b) get automatically rewritten as !(a == b) if the != operator does not exist.
2022-06-04Code style cleanups around insert completerMaxime Coste
2022-05-29Run InsertCompletionHide hook before insertions that close completion menuJohannes Altmanninger
Insert mode completions are accepted by typing any key. For example, if there is a completion "somefunction()", then typing some<c-n>; will insert somefunction(); and then the InsertCompletionHide hook will fire. The hook parameter is a range that contains the entire thing: the actual completion plus the trailing semicolon that closed the completion menu. The [original motivation] for the hook parameter was to support removing text inserted by completion, so we can apply text edits or expand snippets instead. One problem is that we don't want to remove the semicolon. Another problem came up in a discussion about [snippets]: let's say we have a snippet "add" that expands to add(?, ?) where ? are placeholders. After snippet expansion the cursor replaces the first placeholder. If I type "ad<c-n>1" I expect to get "add(1, ?)". If the InsertCompletionHide hook only runs after processing the "1" keystroke, this is not possible without evil hacks. Fix these problems by running InsertCompletionHide when a completion is accepted _before_ inserting anything else into the buffer. This should make it much easier to fully implement [LSP text edits]. I doubt that anyone besides kak-lsp is using the hook parameter today so this should be a low-risk fix. [original motivation]: https://github.com/mawww/kakoune/issues/2898 [snippets]: https://github.com/kak-lsp/kak-lsp/pull/616#discussion_r883208858 [LSP text edits]: https://github.com/kak-lsp/kak-lsp/issues/40
2022-01-09Do not show custom completions when autocomplete is offJohannes Altmanninger
As reported in [1], completions provided by "set global completers option=my_completion" activate insert mode autocompletion, even when the autocomplete option does not have the insert mode flag. This happens because InsertCompleter::on_option_changed() calls InsertCompleter::setup_ifn(), which shows the completion pager. Fix this by computing whether the completion pager is enabled; otherwise we can return early from setup_ifn(). The completion pager is enabled if the autocompletion bit is set, or if the user has requested explicit completion. [1]: https://github.com/kak-lsp/kak-lsp/issues/585
2020-06-27Refactor how InsetCompletionHide hook parameter is computedMaxime Coste
Keep track of inserted ranges instead of trying to re-derive them. Fixes #3556
2019-04-17Change completions option docstring element to be an arbitrary commandMaxime Coste
We can have the previous behaviour by just passing the docstring to `info -placement menu`.
2018-07-15Fix manual insert completion menu not getting automatically hiddenMaxime Coste
Fixes #2208
2018-05-27Refactor option_from_string to return directly the option valueMaxime Coste
2018-05-03Add support for explicit menu selection from the UIMaxime Coste
the JsonUI now supports a "menu_select(int)" RPC call that should trigger explicit selection of the provided item index. As discussed for issue #2019.
2018-04-07Make FaceRegistry scopedMaxime Coste
set-face now takes a scope argument, and faces can be overridden on a buffer or window basis. colorscheme apply on global scope, which should be good enough for now. Fixes #1411
2018-02-27Add support for line completion in all buffersDelapouite
- via completers option with line=all vs line=buffer - via <c-x> L mapping
2017-10-24Add distinct w (curr buf) / W (all buf) word completion for <c-x>Delapouite
2017-10-02Add 'line' in completers option as a way to force explicit <c-x>fDelapouite
2017-09-01Make InsertCompletion an aggregateMaxime Coste
2017-05-22Remove virtual destructor from OptionManagerWatcherMaxime Coste
We should never destruct anything through an OptionManagerWatcher pointer, so having all those destructor virtual makes no sense.
2017-03-16Try to clean up option include a bitMaxime Coste
2017-03-15Migrate to a more value based meta programming modelMaxime Coste
Introduce Meta::Type<T> to store a type as value, and pass it around, migrate enum_desc and option_type_name to this.
2017-02-27Fix clang warnings about uninitialized timestamp fieldMaxime Coste
Closes #1241
2017-01-08Apply clang-tidy modernize to the codebaseMaxime Coste
2016-11-28Add more memory domains to certain dataMaxime Coste
2016-10-01Support codepoints of variable widthMaxime Coste
Add a ColumnCount type and use it in place of CharCount whenever more appropriate, take column size of codepoints into account for vertical movements and docstring wrapping. Fixes #811
2016-09-21Add InsertCompletionShow/InsertCompletionHide hooksMaxime Coste
2016-08-06Add information of types of optionsMaxime Coste
2016-06-27Fix a warning about the forward declaration of SelectionListFrank LENORMAND
2016-04-09Pass the selection list to insert mode completer functionsMaxime Coste
2016-04-04Use a specific option type completions for insert completionMaxime Coste
Fix escaping in jedi.kak as well
2015-12-28Cleanup InsertCompleter get rid of unneeded candidate vector copyMaxime Coste
2015-12-27Fix uses of non-keyword logical operators (replace &&, || and ! with and, or ↵Maxime Coste
and not)
2015-12-27Add a static_words str-list option always considered for word completionMaxime Coste
Fixes #313
2015-10-19Fix handling of explicit insert completersMaxime Coste
2015-10-14Remove unneeded constructorMaxime Coste
2015-10-05Display word insert completion buffer name in a different colorMaxime Coste
2015-09-02Add support for a separate menu text in insert completionsMaxime Coste
Display buffer of origin in word completion menu
2015-08-30Use a named struct for insert completion candidatesMaxime Coste
2015-03-15Store fake keystrokes when selecting an insert completion candidateMaxime Coste
Instead of storing the real 'select next completion' keystroke, generate fake backspace/delete/char keystrokes so that replay of the insert will insert the exact same text. Fixes #135
2015-01-12Some more memory trackingMaxime Coste
2014-12-23Remove trailing blank linesMaxime Coste
2014-11-07Initial support for insert completion docstringMaxime Coste
2014-11-04Fix bug in insert completer deregisteringMaxime Coste
The context options might change, as the context might have a different window/buffer from the one at creation. So we need to store the correct option manager rather than ask the context for it.
2014-11-02Remove AutoRegister util templateMaxime Coste
2014-10-28Style fixesMaxime Coste
2014-10-07Switch some const String& parameters to StringViewMaxime Coste
2014-08-19Remove option checkers, handle that through the type systemMaxime Coste
Use a specific type for InsertCompleterDesc with checks in the option_{from,to}_string functions
2014-05-07Refactor LineAndColumn coordinatesMaxime Coste
BufferCoord -> ByteCoord DisplayCoord -> CharCoord Moved their definition along with LineAndColumn into coord.hh
2014-04-28Extract insert completion code to insert_completer.{cc,hh}Maxime Coste