Commit Graph

20 Commits

Author SHA1 Message Date
Justin M. Keyes
01b6bff7e9 docs: news
Set dev_xx.txt help files to use "flow" layout.
2024-05-15 23:19:26 +02:00
dundargoc
7acf39ddab
docs: misc (#28609)
Closes https://github.com/neovim/neovim/issues/28484.
Closes https://github.com/neovim/neovim/issues/28719.

Co-authored-by: Chris <crwebb85@gmail.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Jake B <16889000+jakethedev@users.noreply.github.com>
Co-authored-by: Jonathan Raines <jonathan.s.raines@gmail.com>
Co-authored-by: Yi Ming <ofseed@foxmail.com>
Co-authored-by: Zane Dufour <zane@znd4.me>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-05-15 07:18:33 +08:00
Justin M. Keyes
783c1e596c
refactor(snippet): rename exit() => stop() #28628 2024-05-06 04:42:30 -07:00
Evgeni Chasnovski
54dfee8f0a docs: add hl-SnippetTabstop tag 2024-05-02 11:39:31 +02:00
Maria José Solano
bc7f86209d
fix(lsp): redundant vim.snippet.jumpable #28560 2024-04-29 13:45:53 -07:00
Mathias Fußenegger
4625394a76
fix(snippet): do not add extra indent on newlines (#28538)
Reverts parts of https://github.com/neovim/neovim/pull/27674

LSP snippets typically do include tabs or spaces to add extra
indentation and don't rely on the client using `autoindent`
functionality.

For example:

    public static void main(String[] args) {\n\t${0}\n}

Notice the `\t` after `{\n`

Adding spaces or tabs independent of that breaks snippets for languages
like Haskell where you can have snippets like:

    ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined}

To generate:

    name ::
    name = undefined
2024-04-28 12:49:25 +02:00
Lewis Russell
14e4b6bbd8 refactor(lua): type annotations 2024-03-16 19:26:10 +00:00
bfredl
8350839a87
Merge pull request #27674 from glepnir/snippet_indent
fix(snippet): correct indent with newline
2024-03-15 09:32:03 +01:00
Lewis Russell
a5fe8f59d9 docs: improve/add documentation of Lua types
- Added `@inlinedoc` so single use Lua types can be inlined into the
  functions docs. E.g.

  ```lua
  --- @class myopts
  --- @inlinedoc
  ---
  --- Documentation for some field
  --- @field somefield integer

  --- @param opts myOpts
  function foo(opts)
  end
  ```

  Will be rendered as

  ```
  foo(opts)

    Parameters:
      - {opts} (table) Object with the fields:
               - somefield (integer) Documentation
                 for some field
  ```

- Marked many classes with with `@nodoc` or `(private)`.
  We can eventually introduce these when we want to.
2024-03-01 23:02:18 +00:00
glepnir
a5ade3c63d fix(snippet): correct indent with newline
Problem: snippet newline use before line indent after expand.

Solution: it should level + 1.
2024-03-01 14:35:52 +08:00
Lewis Russell
9beb40a4db feat(docs): replace lua2dox.lua
Problem:

The documentation flow (`gen_vimdoc.py`) has several issues:
- it's not very versatile
- depends on doxygen
- doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C.
- The intermediate XML files and filters makes it too much like a rube goldberg machine.

Solution:

Re-implement the flow using Lua, LPEG and treesitter.

- `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic.
- `lua2dox.lua` is gone!
- No more XML files.
- Doxygen is now longer used and instead we now use:
  - LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`).
  - LPEG for C parsing (see `scripts/cdoc_parser.lua`)
  - Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`).
  - Treesitter for Markdown parsing (see `scripts/text_utils.lua`).
- The generated `runtime/doc/*.mpack` files have been removed.
   - `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly.
- Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
2024-02-27 14:41:17 +00:00
Maria José Solano
0e9a33572d fix(lsp): handle adjacent snippet tabstops 2024-02-05 15:03:46 +00:00
dundargoc
2e982f1aad refactor: create function for deferred loading
The benefit of this is that users only pay for what they use. If e.g.
only `vim.lsp.buf_get_clients()` is called then they don't need to load
all modules under `vim.lsp` which could lead to significant startuptime
saving.

Also `vim.lsp.module` is a bit nicer to user compared to
`require("vim.lsp.module")`.

This isn't used for some nested modules such as `filetype` as it breaks
tests with error messages such as "attempt to index field 'detect'".
It's not entirely certain the reason for this, but it is likely it is
due to filetype being precompiled which would imply deferred loading
isn't needed for performance reasons.
2024-02-03 16:53:41 +01:00
Maria José Solano
a1bdf2852d
fix(snippet): remove misleading comment about TM_FILENAME_BASE (#26465) 2023-12-08 21:23:46 +01:00
Maria José Solano
7e36c8e972 feat(lsp): support for choice snippet nodes 2023-11-17 17:10:27 +01:00
Maria José Solano
0fe0cf5ada
fix(lsp): do not cancel snippet when selecting placeholder (#25835) 2023-10-30 12:58:28 +01:00
Maria José Solano
15983cf2c6
fix(lsp): cancel session when leaving snippet region (#25762) 2023-10-26 07:29:05 +02:00
Maria José Solano
94127cb5df fix(lsp): do not add extra indentation 2023-10-23 17:21:41 +02:00
Maria José Solano
370232dbef fix(lsp): track snippet deletion 2023-10-23 17:21:41 +02:00
Maria José Solano
f1775da07f
feat(lsp): add snippet API (#25301) 2023-10-21 08:51:26 +02:00