Skip to content

Commit

Permalink
chore(build): auto-generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 17, 2024
1 parent 63ec294 commit 8c8902a
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 55 deletions.
60 changes: 28 additions & 32 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Config
description: Configuration for care.nvim
---

# Config

<details>
<summary>Full Default Config</summary>
Expand Down Expand Up @@ -94,24 +95,20 @@ config.defaults = {
```

</details>
# Config

The config of care is used to configure the ui and care itself.
The config of care is used to configure the UI and care itself.

There are two main parts to the config. The first one is the `ui` field and the
second on is the rest of the configuration which is for configuring the general
behavior of care.
The configuration consists of two main parts. The UI Configuration and the
configuration of the completion behaviors of care.
# `care.config`

# Methods

## Snippet Expansion
`config.snippet_expansion(string): nil`

Here a function for expanding snippets is defined. By default this is the
builtin `vim.snippet.expand()`. You can also use a plugin like luasnip for this
like this:
`config.snippet_expansion(body: string): nil`

With this field a function for expanding snippets is defined. By default this is the
builtin `vim.snippet.expand()`. You can also use a plugin like luasnip for this:
```lua
snippet_expansion = function(body)
require("luasnip").lsp_expand(body)
Expand All @@ -128,15 +125,10 @@ disables care in prompts.
## Ui
`config.ui care.config.ui`

The [ui configuration](#Ui-Configuration) is used to configure the whole ui of care. One of the main
goals of this is to be as extensible as possible. This is especially important
The [UI Configuration](#Ui-Configuration) is used to configure the whole UI of care.
One of the main goals of this is to be as extensible as possible. This is especially important
for the completion entries. Read more about that under
[Configuration of item display](/design/#configuration-of-item-display).
The most important part for many users will be the `menu` field. It's used to
configure the completion menu.
You can also configure the documentation view just like the main menu.
Lastly the users can also configure the icons which will be used for the
different items.

## Selection Behavior
`config.selection_behavior "select"|"insert"`
Expand All @@ -149,33 +141,35 @@ the entry (this is not necessarily the whole text).
## Confirm Behavior
`config.confirm_behavior "insert"|"replace"`

Behavior when confirming entry
This field controls the behavior when confirming an entry.

## Sources
`config.sources care.config.source[]`

Configuration for the different sources
This field is used to configure the sources for care.nvim.

## Completion Events
`config.completion_events string[]`

The `completion_events` table is used to set events for completion. By default
The `completion_events` table is used to set events for autocompletion. By default
it just contains `"TextChangedI"`. You can set it to an empty table (`{}`) to
disable autocompletion.

## Keyword Pattern
`config.keyword_pattern string`

Pattern used to determine keywords, used to determine what to use for filtering
and what to remove if insert text is used.
The keyword pattern is used to determine keywords. These are used to determine what
to use for filtering and what to remove if insert text is used.
It should essentially just describe the entries of a source.

## Preselect
`config.preselect boolean`

Whether items should be preselected or not
Whether items should be preselected or not. Which items are preselected is determined
by the source.

# Ui Configuration
The main class for the ui configuration of care.nvim
This is used to configure the whole UI of care.
# `care.config.ui`

# Fields
Expand All @@ -200,9 +194,9 @@ This is a table which defines the different icons.
## Ghost Text
`config.ui.ghost_text care.config.ui.ghost_text`

Configuration of ghost text
Configuration of ghost text.

Configuration for the ghost text
With this field the user can control how ghost text is displayed.
# `care.config.ui.ghost_text`

# Fields
Expand All @@ -211,14 +205,14 @@ Configuration for the ghost text
`config.ui.ghost_text.enabled boolean`

You can use the `enabled` field to determine whether the ghost text should be
enabled or not. The `position` can either be `"inline"` or `"overlay"`. Inline
will add the text inline right where the cursor is. With the overlay position
the text will overlap with existing text after the cursor.
enabled or not.

## Position
`config.ui.ghost_text.position "inline"|"overlay"`


The `position` can either be `"inline"` or `"overlay"`. Inline
will add the text inline right where the cursor is. With the overlay position
the text will overlap with existing text after the cursor.

This configuration should allow you to completely adapt the completion menu to
your likings.
Expand All @@ -232,7 +226,8 @@ scrollbar. Set `scrollbar` to `nil` value to disable the scrollbar.

## Format Entry
`config.ui.menu.format_entry(entry: care.entry): { [1]: string, [2]: string }[][]`
See: [care.entry](/dev/entry)

See [care.entry](/dev/entry)

Another field is `format_entry`. This is a function which recieves an entry of
the completion menu and determines how it's formatted. For that a table with
Expand Down Expand Up @@ -300,7 +295,8 @@ Whether the source is enabled (default true)

## Filter
`config.source.filter(entry: care.entry): boolean`
See: [care.entry](/dev/entry)

See [care.entry](/dev/entry)

Filter function for entries by the source
# Fields
Expand Down
12 changes: 8 additions & 4 deletions docs/dev/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ cursor position. It is passed to completion sources to get completions.

## Changed
`context.changed(care.context): boolean`
See: [care.context](/dev/context)

See [care.context](/dev/context)

Whether the context changed in comparison to the previous one. This is used to
check whether to get new completions or not when using autocompletion.

## New
`Context.new(previous: care.context?): care.context`
See: [care.context](/dev/context)

See [care.context](/dev/context)

Create a new context. This takes a previous context as argument. This one is
stored to determine if the context changed or not when completing. The previous
Expand All @@ -30,15 +32,17 @@ really large.

## Previous
`context.previous care.context?`
See: [care.context](/dev/context)

See [care.context](/dev/context)

The previous context which is used to determine whether the context changed or
not. The `previous` field of the previous context should always be `nil` so the
data structure doesn't grow infinitely.

## Cursor
`context.cursor care.context.cursor`
See: [care.context](/dev/context)

See [care.context](/dev/context)

The cursor position. This will have a `col` and a `row` field and has 1-based
line and 0-based column indexes. This is the same as in
Expand Down
9 changes: 6 additions & 3 deletions docs/dev/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ most important things being the menu being opened and the completion triggered.

## New
`Core.new(): care.core`
See: [care.core](/dev/core)

See [care.core](/dev/core)

Use this function to create a new instance. It takes no arguments and should be
called only once when the plugin is first set up.
Expand Down Expand Up @@ -54,14 +55,16 @@ Filter currently visible menu. This is used when moving the cursor.

## Context
`core.context care.context`
See: [care.context](/dev/context)

See [care.context](/dev/context)

This is used to store the current context. There is always a new one created in
`on_change` and compared to see if it changed.

## Menu
`core.menu care.menu`
See: [care.menu](/dev/menu)

See [care.menu](/dev/menu)

In this field a menu instance which is used in core is stored.

Expand Down
9 changes: 6 additions & 3 deletions docs/dev/entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ completion item for which the lsp type is used.

## New
`Entry.new(completion_item: lsp.CompletionItem, source: care.internal_source, context: care.context): care.entry`
See: [care.entry](/dev/entry), [care.context](/dev/context), [care.internal_source](/dev/internal_source)

See [care.entry](/dev/entry), [care.context](/dev/context), [care.internal_source](/dev/internal_source)

The new function is the constructor for a new completion entry.

Expand Down Expand Up @@ -59,14 +60,16 @@ Gets the default range for entry (if there is no textEdit)

## Source
`entry.source care.internal_source`
See: [care.internal_source](/dev/internal_source)

See [care.internal_source](/dev/internal_source)

This is the source from which the entry came. This is important for using the right keyword
pattern and getting the right offset.

## Context
`entry.context care.context`
See: [care.context](/dev/context)

See [care.context](/dev/context)

This is the context in which the entry was completed. This is important to now what context text-
edits of the entry target.
Expand Down
12 changes: 8 additions & 4 deletions docs/dev/internal_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ metadata about which the source author doesn't have to care and sometimes can't

## New
`Internal_source.new(completion_source: care.source): care.internal_source`
See: [care.internal_source](/dev/internal_source), [care.source](/dev/source)

See [care.internal_source](/dev/internal_source), [care.source](/dev/source)

This function creates a new instance.

Expand All @@ -25,7 +26,8 @@ method to get it and as fallback the one from the config.

## Get Offset
`internal_source:get_offset(context: care.context): integer`
See: [care.context](/dev/context)

See [care.context](/dev/context)

With this function the offset of the source is determined. The offset describes at which point
the completions for this source start. This is required to be able to remove that text if needed
Expand All @@ -45,13 +47,15 @@ This function checks whether the function is enabled or not based on it's config

## Source
`internal_source.source care.source`
See: [care.source](/dev/source)

See [care.source](/dev/source)

This field is used to store the source written by the source author.

## Entries
`internal_source.entries care.entry[]`
See: [care.entry](/dev/entry)

See [care.entry](/dev/entry)

In the entries field entries gotten from the source are stored. This is used to be able to sort
and filter the entries when not getting new ones.
Expand Down
21 changes: 14 additions & 7 deletions docs/dev/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ completions.

## New
`Menu.new(): care.menu`
See: [care.menu](/dev/menu)

See [care.menu](/dev/menu)

Creates a new instance of the completion menu.

Expand Down Expand Up @@ -46,7 +47,8 @@ This function is used to select the previous entry analogous to

## Open
`menu:open(entries: care.entry[], offset: integer): nil`
See: [care.entry](/dev/entry)

See [care.entry](/dev/entry)

The `open` function is used to open the completion menu with a specified set of
entries. This includes opening the window and displaying the text.
Expand All @@ -58,7 +60,8 @@ This function closes the menu and resets some internal things.

## Get Active Entry
`menu:get_active_entry(): care.entry?`
See: [care.entry](/dev/entry)

See [care.entry](/dev/entry)

With this function you can get the currently selected entry. This can be used
for the docs view or some other api functions. It is also used when the
Expand All @@ -72,7 +75,8 @@ the selected entry closes the menu and completes.

## Complete
`menu:complete(entry: care.entry): nil`
See: [care.entry](/dev/entry)

See [care.entry](/dev/entry)

This function completes with a given entry. That means it removes text used for
filtering (if necessary), expands snippet with the configured function, applies
Expand All @@ -96,13 +100,15 @@ Scroll up or down in the docs window by `delta` lines.

## Menu Window
`menu.menu_window care.window`
See: [care.window](/dev/window)

See [care.window](/dev/window)

Wrapper for utilities for the window of the menu

## Docs Window
`menu.docs_window care.window`
See: [care.window](/dev/window)

See [care.window](/dev/window)

Wrapper for utilities for the window of the docs

Expand All @@ -113,7 +119,8 @@ The ghost text instance used to draw the ghost text.

## Entries
`menu.entries care.entry[]`
See: [care.entry](/dev/entry)

See [care.entry](/dev/entry)

This field is used to store all the entries of the completion menu.

Expand Down
6 changes: 4 additions & 2 deletions docs/dev/window.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Utility class for working with windows in care

## New
`Window.new(): care.window`
See: [care.window](/dev/window)

See [care.window](/dev/window)

Creates a new instance of the menu window

Expand Down Expand Up @@ -63,7 +64,8 @@ Change scroll of window

## Get Data
`window:get_data(): care.window.data`
See: [care.window](/dev/window)

See [care.window](/dev/window)


# Fields
Expand Down

0 comments on commit 8c8902a

Please sign in to comment.