Commit Graph

21 Commits

Author SHA1 Message Date
3b6084ddf4 fix: type fixes
Type fixes caught by emmylua
2025-06-06 15:36:48 +01:00
67c39f5eca fix(tohtml): disable modeline #32822
Problem:
Running :TOhtml with a file containing modeline may generate an invalid modeline in the output.

Solution:
Add `<!-- vim: set nomodeline: -->` to the output.
Use vi-compatible modeline format ("set foo:"), to avoid the trailing `-->` being treated as part of the modeline.
2025-03-10 09:15:41 -07:00
35e5307af2 feat(terminal)!: include cursor position in TermRequest event data (#31609)
When a plugin registers a TermRequest handler there is currently no way
for the handler to know where the terminal's cursor position was when
the sequence was received. This is often useful information, e.g. for
OSC 133 sequences which are used to annotate shell prompts.

Modify the event data for the TermRequest autocommand to be a table
instead of just a string. The "sequence" field of the table contains the
sequence string and the "cursor" field contains the cursor
position when the sequence was received.

To maintain consistency between TermRequest and TermResponse (and to
future proof the latter), TermResponse's event data is also updated to
be a table with a "sequence" field.

BREAKING CHANGE: event data for TermRequest and TermResponse is now a
table
2025-03-05 09:45:22 -06:00
6aa42e8f92 fix: resolve all remaining LuaLS diagnostics 2025-01-27 16:37:50 +00:00
22fd52325b fix(inspector): update semantic token namespace (#32157)
This updates the extmark namespace to search for when filtering out
semantic tokens to match the new namespace style recently introduced.
2025-01-22 21:02:30 +08:00
e37404f7fe fix(tohtml): enclose font-family names in quotation marks
Font-family names must be enclosed in quotation marks to ensure that
fonts are applied correctly when there are spaces in the name.

Fix an issue where multiple fonts specified in `vim.o.guifont` are
inserted as a single element, treating them as a single font.

Support for escaping commas with backslash and ignoring spaces
after a comma.

ref `:help 'guifont'`
2024-09-08 12:15:50 +02:00
59baa5e8a1 fix(tohtml): apply sp color if present #30110
Problem:
Things like underlines are always given a default foreground highlight
regardless of the value of `sp`.

Solution:
Check for `sp` first, and apply that color to the text decoration color if it
exists.

Limitations:
If there is no value of `sp`, vim applies a text decoration color that matches
the foreground of the text. This is still not implemented (and seems like a much
more complex problem): in TOhtml, the underline will still be given a default
foreground highlight.
2024-08-29 09:36:33 -07:00
118ae7e5ed fix(tohtml): support ranges again 2024-07-16 15:07:40 +02:00
25db0a1385 fix(tohtml): extmark text may be out of bounds 2024-07-16 08:11:26 +01:00
aa6b9c677d refactor: use vim._with where possible
This mostly means replacing `nvim_buf_call` and `nvim_win_call` with
`vim._with`.
2024-06-28 19:58:31 +02:00
8cbb1f20e5 refactor(lua): use tuple syntax everywhere #29111 2024-06-04 06:06:02 -07:00
6e8a728e3d refactor: fix luals type warnings 2024-05-27 20:48:46 +02:00
eb37241d38 fix(tohtml): properly handle multiple hl groups #29012
Problem: :TOhtml doesn't properly handle virtual text when it has
multiple highlight groups. It also improperly calculates position offset
for multi-byte virt_text characters.

Solution: Apply the `vim.api.nvim_strwidth` broadly to properly
calculate character offset, and handle the cases where the `hl` argument
can be a table of multiple hl groups.
2024-05-26 10:27:12 -07:00
88c7997503 fix(tohtml): show how many warnings are hidden 2024-05-26 13:57:30 +02:00
8cd9feb501 fix(tohtml): ignore lsp inlay hints 2024-05-26 13:14:40 +02:00
2ed6423c7e fix(tohtml): replace ipairs with pairs 2024-05-26 12:56:32 +02:00
e52c25b761 feat(lua): deprecate vim.tbl_add_reverse_lookup 2024-03-07 10:24:34 +01:00
85b13751a5 refactor(types): more fixes (2) 2024-03-06 16:03:33 +00:00
a8131aee9e fix(tohtml): replace hex escape with digit escape (#27728) 2024-03-04 19:08:23 +08:00
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
2f85bbe615 feat!: rewrite TOhtml in lua
Co-authored-by: wookayin <wookayin@gmail.com>
Co-authored-by: clason <c.clason@uni-graz.at>
Co-authored-by: Lewis Russell <me@lewisr.dev>
2024-02-28 16:26:00 +00:00