Skip to content

Commit

Permalink
added help doc for opts
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-jpq committed Jan 2, 2022
1 parent 407901e commit db57cc3
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ There is built-in [help command](https://github.com/ms-jpq/coq_nvim/tree/coq/doc

- [:COQhelp fuzzy](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/FUZZY.md)

- [:COQhelp comp](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/COMPLETION.md)

- [:COQhelp display](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/DISPLAY.md)

- [:COQhelp sources](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/SOURCES.md)
Expand Down
1 change: 1 addition & 0 deletions autoload/coq.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function! coq#complete_help(arg_lead, cmd_line, cursor_pos) abort
\ 'keybind',
\ 'snips',
\ 'fuzzy',
\ 'comp',
\ 'display',
\ 'sources',
\ 'misc',
Expand Down
1 change: 1 addition & 0 deletions config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ keymap:
eval_snips: null

completion:
always: True
smart: True

match:
Expand Down
3 changes: 3 additions & 0 deletions coq/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,8 @@
MD_PREF = _DOC_DIR / "PERF.md"
URI_PREF = _URI_BASE + MD_PREF.name

MD_COMPLETION = _DOC_DIR / "COMPLETION.md"
URI_COMPLETION = _URI_BASE + MD_COMPLETION.name

MD_C_SOURCES = _DOC_DIR / "CUSTOM_SOURCES.md"
URI_C_SOURCES = _URI_BASE + MD_C_SOURCES.name
5 changes: 3 additions & 2 deletions coq/server/registrants/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ async def cont() -> None:
await awrite(nvim, msg)

if (
not qmsg.pending
stack.settings.completion.always
and not qmsg.pending
and qmsg.mode.startswith("i")
and qmsg.comp_mode in {"", "eval", "function", "ctrl_x"}
):
comp_func(nvim, stack=stack, s=s, manual=False)
comp_func(nvim, s=s, manual=False)

go(nvim, aw=cont())

Expand Down
5 changes: 5 additions & 0 deletions coq/server/registrants/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from ...consts import (
MD_C_SOURCES,
MD_COMPLETION,
MD_CONF,
MD_DISPLAY,
MD_FUZZY,
Expand All @@ -23,6 +24,7 @@
MD_SOURCES,
MD_STATS,
URI_C_SOURCES,
URI_COMPLETION,
URI_CONF,
URI_DISPLAY,
URI_FUZZY,
Expand All @@ -44,6 +46,7 @@ class _Topics(Enum):
keybind = auto()
snips = auto()
fuzzy = auto()
comp = auto()
display = auto()
sources = auto()
misc = auto()
Expand All @@ -63,6 +66,8 @@ def _directory(topic: _Topics) -> Tuple[Path, str]:
return MD_SNIPS, URI_SNIPS
elif topic is _Topics.fuzzy:
return MD_FUZZY, URI_FUZZY
elif topic is _Topics.comp:
return MD_COMPLETION, URI_COMPLETION
elif topic is _Topics.display:
return MD_DISPLAY, URI_DISPLAY
elif topic is _Topics.sources:
Expand Down
4 changes: 2 additions & 2 deletions coq/server/registrants/omnifunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async def c2() -> None:
atomic.exec_lua(f"{NAMESPACE}.{_launch_loop.name}()", ())


def comp_func(nvim: Nvim, stack: Stack, s: State, manual: bool) -> None:
def comp_func(nvim: Nvim, s: State, manual: bool) -> None:
_Q.put((s, manual))


Expand All @@ -156,7 +156,7 @@ def omnifunc(
return -1
else:
s = state(commit_id=uuid4())
comp_func(nvim, stack=stack, manual=True, s=s)
comp_func(nvim, manual=True, s=s)
return ()


Expand Down
1 change: 1 addition & 0 deletions coq/shared/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Weights:

@dataclass(frozen=True)
class CompleteOptions:
always: bool
smart: bool


Expand Down
27 changes: 27 additions & 0 deletions docs/COMPLETION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Completion

### coq_settings.completion

#### coq_settings.completion.always

Always trigger completion on keystroke

**default:**

```json
true
```

---

#### coq_settings.completion.smart

Tries (even harder) to reconcile differences between document and modifications.

ie. extended fuzzy logic

**default:**

```json
true
```
4 changes: 4 additions & 0 deletions docs/CONF.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ Key bindings

Fuzzy ranking

- [:COQhelp comp](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/COMPLETION.md)

Completion options

- [:COQhelp display](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/DISPLAY.md)

Appearances
Expand Down
2 changes: 1 addition & 1 deletion docs/DISPLAY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The virtual text previewing selected completion
**default:**

```json
True
true
```

##### `coq_settings.display.ghost_text.context`
Expand Down
2 changes: 1 addition & 1 deletion docs/KEYBIND.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Keybind

`coq_settings.keymap`
## coq_settings.keymap

### coq_settings.keymap.recommended

Expand Down
4 changes: 2 additions & 2 deletions docs/MISC.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Misc

### coq.limits
### coq_settings.limits

Various timeouts and retry limits

#### `coq.limits.index_cutoff`
#### `coq_settings.limits.index_cutoff`

Buffers above this size will not be indexed.

Expand Down

0 comments on commit db57cc3

Please sign in to comment.