Commit Graph

727 Commits

Author SHA1 Message Date
bfredl
628763fbd8 docs(lua): the keyset nilocalypse
This is needed to give recent LuaLS the right idea about optional fields.
2023-08-08 10:42:59 +02:00
bfredl
3a21c3afe6
Merge pull request #24524 from bfredl/typed_keys
refactor(api): use typed keysets
2023-08-07 14:42:25 +02:00
bfredl
7bc93e0e2f refactor(api): use typed keysets
Initially this is just for geting rid of boilerplate,
but eventually the types could get exposed as metadata
2023-08-07 13:11:15 +02:00
Lewis Russell
6fa17da39b
docs(options): take ownership of options.txt (#24528)
* docs(options): take ownership of options.txt

- `src/nvim/options.lua` is now the source of truth
- generate runtime/lua/vim/_meta/options.lua

* fixup! zeer comments

* fixup! zeer comments (2)

* fixup! re-enable luacheck

* fixup! regen
2023-08-04 21:26:53 +01:00
Justin M. Keyes
b1fb04475e docs: remove "#" comment char in @return
Everything after a "#" char is a "description" comment, i.e. luals won't
treat it as a type, name, etc. But "#" should not be present in the
generated docs (such as :help docs).
https://github.com/LuaLS/lua-language-server/wiki/Annotations#return
2023-08-03 14:01:53 +02:00
Raphael
214b125132
fix(gen_lsp.lua): no notifications in lsp.Methods #24530
Problem:
- Notifications are missing from `lsp.Methods`.
- Need a way to represent `$/` prefixed methods.

Solution:
- Generate notifications.
- Use "dollar_" prefix for `$/` methods.
2023-08-03 02:52:21 -07:00
Justin M. Keyes
d086bc1e85
docs: drop "Can also be used as a method" #24508
Now that we "own" builtin.txt, we cant remove the repetitive mention of
Vimscript's UFCS syntax. It's noisy to mention this for each function,
and it's also not a Vimscript feature that should be encouraged.

Also change the builtin.txt heading to "NVIM REFERENCE MANUAL", which
indicates when a help file is Nvim-owned.
2023-08-01 16:17:26 -07:00
Justin M. Keyes
dfe19d6e00
Merge #24504 feat(lsp): protocol.Methods 2023-08-01 07:36:57 -07:00
Justin M. Keyes
f41496ce74 feat(gen_lsp.lua): sort by name, handle failure #24504 2023-08-01 16:13:22 +02:00
mathew
da09f9b551 feat(gen_lsp.lua): protocol.Methods #24504 2023-08-01 16:05:06 +02:00
Lewis Russell
48d533272e
feat(lua-types): types for vim.api.* (#24523) 2023-08-01 14:20:44 +01:00
Lewis Russell
20bfdbe832
docs(builtin): right align tags (#24522) 2023-08-01 11:12:00 +01:00
Lewis Russell
9b5f58185e
docs(builtin): fix and annotate language blocks (#24506) 2023-08-01 09:57:52 +01:00
Lewis Russell
42333ea98d
feat(docs): generate builtin.txt (#24493)
- eval.lua is now the source of truth.

- Formatting is much more consistent.

- Fixed Lua type generation for polymorphic functions (get(), etc).

- Removed "Overview" section from builtin.txt
  - Can generate this if we really want it.

- Moved functions from sign.txt and testing.txt into builtin.txt.

- Removed the *timer* *timers* tags since libuv timers via vim.uv should be preferred.

- Removed the temp-file-name tag from tempname()

- Moved lueval() from lua.txt to builtin.txt.

* Fix indent

* fixup!

* fixup! fixup!

* fixup! better tag formatting

* fixup: revert changes no longer needed

* fixup! CI

---------

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-07-28 14:48:41 +01:00
zeertzjq
ccf328172b
fix(gen_vimfn_types): don't include tag before signature's line (#24492)
When signature is a bit long or there are too many tags, the tags appear
before the signature's line. Don't include the line with tags in the
previous function' docs.

Also fix lint warnings.
2023-07-26 21:07:39 +08:00
Lewis Russell
fd089c8e50
feat(lua): typing for vim.fn.* (#24473)
Problem:
  No LSP information for `vim.fn.*`

Solution:
  Add meta file for `vim.fn.*`.
2023-07-26 09:50:54 +01:00
zeertzjq
ca9f4a7cb1
docs: also change "vimL" and "viml" to "Vimscript" (#24414) 2023-07-21 16:30:05 +08:00
Lewis Russell
be74807eef
docs(lua): more improvements (#24387)
* docs(lua): teach lua2dox how to table

* docs(lua): teach gen_vimdoc.py about local functions

No more need to mark local functions with @private

* docs(lua): mention @nodoc and @meta in dev-lua-doc

* fixup!

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>

---------

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2023-07-18 15:42:30 +01:00
kylo252
d0ae529861
build(scripts): allow a git ref for lsp_types #24377
USAGE:
nvim -l scripts/lsp_types.lua gen
nvim -l scripts/lsp_types.lua gen --build/new_lsp_types.lua
nvim -l scripts/lsp_types.lua gen --out runtime/lua/vim/lsp/types/protocol.lua --ref 2023.0.0a2
2023-07-18 06:00:44 -07:00
Lewis Russell
9fcb0a64ee
refactor(lua2dox): overhaul (#24386) 2023-07-18 12:24:53 +01:00
Lewis Russell
6e9b204afb fix: doc errors 2023-07-17 17:09:16 +01:00
Lewis Russell
e6e0bc225b refactor(gen_vimdoc): put defgroup handling in a function 2023-07-17 16:25:29 +01:00
Lewis Russell
c2d7c2826c docs(lua): change *lua-foo* -> *vim.foo* 2023-07-17 16:25:29 +01:00
Lewis Russell
0ac3c4d631 docs(lua): move function docs to lua files 2023-07-17 16:25:28 +01:00
Lewis Russell
3fd504dbec docs: handle whitespace in emmycomments 2023-07-17 12:59:10 +01:00
Lewis Russell
a54f88ea64 docs(lua): do not render self args 2023-07-17 12:59:06 +01:00
Justin M. Keyes
0a90e4b05a fix(docs): match DocSearch style with site theme
ref 2b4f9e4780
2023-07-08 16:06:46 +02:00
Justin M. Keyes
d2e44da516 docs: gather @notes items into one section
related: 21eacbfef3
2023-07-08 15:06:36 +02:00
Justin M. Keyes
3a721820c3 docs: "Return (multiple)" heading
Problem:
Lua functions that return multiple results are declared by using
multiple `@return` docstring directives. But the generated docs don't
make it obvious what this represents.

Solution:
- Generate a "Return (multiple)" heading for multiple-value functions.
- Fix `@note` directives randomly placed after `@return`.
2023-07-08 15:06:36 +02:00
Sean Dewar
77118d0da8
fix(api): use text_locked() to check textlock
Problem: some API functions that check textlock (usually those that can change
curwin or curbuf) can break the cmdwin.

Solution: make FUNC_API_CHECK_TEXTLOCK call text_locked() instead, which already
checks for textlock, cmdwin and `<expr>` status.

Add FUNC_API_TEXTLOCK_ALLOW_CMDWIN to allow such functions to be usable in the
cmdwin if they can work properly there; the opt-in nature of this attribute
should hopefully help mitigate future bugs.

Also fix a regression in #22634 that made functions checking textlock usable in
`<expr>` mappings, and rename FUNC_API_CHECK_TEXTLOCK to FUNC_API_TEXTLOCK.
2023-07-05 08:31:52 +01:00
Justin M. Keyes
6da110d617
docs(gen_help_html): accept "~/" in file/dir params #24240 2023-07-03 05:04:43 -07:00
Justin M. Keyes
ab65a98adb
fix(docs): ignore_invalid #24174
Regex bug in scripts/gen_help_html.lua:ignore_invalid()
2023-06-27 10:21:27 -07:00
Justin M. Keyes
957d05d16b
fix(docs): too much whitespace around <pre> blocks #24151
Problem:
In the generated docs HTML there is too much whitespace before/after `<pre>`
blocks.
- In the old layout (fixed-width), all text in `.old-help-para` is formatted as
  `white-space:pre`.
- In the new layout, when `<pre>` is at the end of a `<div>`, the margins of
  both are redundant, causing too much space.

Solution:
- In the old layout, always remove `<pre>` margin.
- In the new layout, disable `<pre>` margin if it is the last child.
2023-06-25 12:29:56 -07:00
Justin M. Keyes
49a7585981 docs: autocmds, misc 2023-06-25 17:25:47 +02:00
Justin M. Keyes
036da0d079 fix(docs): vimdoc syntax errors
gen_help_html: truncate parse-error sample text
2023-06-25 17:14:28 +02:00
Justin M. Keyes
4e6356559c
test: spellcheck :help (vimdoc) files #24109
Enforce consistent terminology (defined in
`gen_help_html.lua:spell_dict`) for common misspellings.

This does not spellcheck English in general (perhaps a future TODO,
though it may be noisy).
2023-06-22 03:44:51 -07:00
Justin M. Keyes
b0cf9c5fee feat(gen_help_html): ignore pi_netrw.txt errors
IDGAF about netrw
2023-06-22 10:18:24 +02:00
Justin M. Keyes
81d8fce8f9 feat(gen_help_html): non-default vimdoc.so parser
Callers can specify a non-default vimdoc.so file path.
2023-06-22 10:18:24 +02:00
Justin M. Keyes
5c73b1bb4c docs: lsp, vim_diff
- quickstart
- mark lsp.txt as `new_layout`
- remove lsp-handler documentation for notifications: they don't have
  handlers because they don't have server responses.
2023-06-22 10:18:17 +02:00
Chinmay Dalal
ca5de9306c
feat(lsp): inlay hints #23984
Add automatic refresh and a public interface on top of #23736

 * add on_reload, on_detach handlers in `enable()` buf_attach, and
  LspDetach autocommand in case of manual detach
* unify `__buffers` and `hint_cache_by_buf`
* use callback bufnr in `on_lines` callback, bufstate: remove __index override
* move user-facing functions into vim.lsp.buf, unify enable/disable/toggle

Closes #18086
2023-06-19 23:06:54 -07:00
Justin M. Keyes
72a6643b13
docs #24061
- nvim requires rpc responses in reverse order. https://github.com/neovim/neovim/issues/19932
- NVIM_APPNAME: UIs normally should NOT set this.

ref #23520
fix #24050
fix #23660
fix #23353
fix #23337
fix #22213
fix #19161
fix #18088
fix #20693
2023-06-19 08:40:33 -07:00
Chinmay Dalal
643546b82b
feat(lsp): add handlers for inlay hints (#23736)
initial support; public API left for a follow-up PR
2023-06-11 11:53:37 +02:00
Lewis Russell
c0952e62fd
feat(lua): add vim.system()
feat(lua): add vim.system()

Problem:

  Handling system commands in Lua is tedious and error-prone:
  - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval.
  - vim.loop.spawn is too low level

Solution:

  Add vim.system().
  Partly inspired by Python's subprocess module
  Does not expose any libuv objects.
2023-06-07 13:52:23 +01:00
max397574
5f4895200a
feat(scripts): add lsp_types.lua (#23750) 2023-06-07 12:32:39 +01:00
Justin M. Keyes
c48b1421af
refactor!: rename "playground" => "dev" #23919
Problem:
"playground" is new jargon that overlaps with existing concepts:
"dev" (`:help dev`) and "view" (also "scratch" `:help scratch-buffer`) .

Solution:
We should consistently use "dev" as the namespace for where "developer
tools" live. For purposes of a "throwaway sandbox object", we can use
the name "view".
- Rename `TSPlayground` => `TSView`
- Rename `playground.lua` => `dev.lua`
2023-06-06 08:23:20 -07:00
Justin M. Keyes
36fd2fcaae
docs(html): define anchors for search engine #23879
Problem:
Selecting a search result from the Algolia Docsearch widget does not
navigate to a page anchor. The docs HTML provides `<a name=…>` anchors
_near_ the `<h1>`/`<h2>`/… headings, but Algolia Docsearch expects the
anchors to be _defined on_ the headings. That's also "semantically"
nicer. https://docsearch.algolia.com/docs/manage-your-crawls/

Solution:
Set `id` on the heading element instead of placing `<a name=…>` nearby.

related: 3913ebbfcd #23839
2023-06-02 02:45:23 -07:00
Justin M. Keyes
3913ebbfcd
docs(html): algolia docsearch #23839
Need to manually include this in the generated docs html because it
doesn't use the website's (jekyll) layout template.

Maintenance notes:
https://github.com/neovim/neovim.github.io/#maintenance

Related: ce9aef12eb
2023-05-30 17:32:38 -07:00
zeertzjq
d3a22ff242
build(vim-patch.sh): use bundled uncrustify (#23770) 2023-05-26 22:22:56 +08:00
Christian Clason
ed8c44f767
ci(deps): update bump_deps script (#23604)
* consistent capitalization (lower-case) of dependency names
* add bundled tree-sitter parsers
2023-05-13 11:44:56 +02:00
zeertzjq
84378c4dd5
test(old): remove python2 tests (#23547)
Because python2 provider is no longer supported.
2023-05-09 09:18:21 +08:00