Commit graph

78 commits

Author SHA1 Message Date
Folke Lemaitre
8d073ccc0c
feat(image): use tectonic when available 2025-02-17 23:56:21 +01:00
Folke Lemaitre
c3419cbf8b
refactor(image): use multi spawn 2025-02-17 23:13:12 +01:00
Folke Lemaitre
4898d904db
refactor(image): convert 2025-02-17 17:23:11 +01:00
Folke Lemaitre
39bf5131c4
feat(image): enabled pdf previews 2025-02-17 17:17:56 +01:00
Folke Lemaitre
d7c8fd9a48
fix(image): show full size when not showing image inline 2025-02-17 16:07:04 +01:00
Folke Lemaitre
c1a1984fdb
fix(image): don't fallback to convert on windows, since that is a system tool 2025-02-17 14:29:25 +01:00
Folke Lemaitre
1f9ba12755
fix(image.hover): close when needed. Closes #1229 2025-02-17 14:37:27 +01:00
Folke Lemaitre
4589e25758
fix(image.health): allow convert if magick not available 2025-02-17 14:00:37 +01:00
Grzegorz Rozdzialik
9a5e4deaec
fix(image): do not attach to invalid buffers (#1238)
## Description

**Problem**: Sometimes when entering Insert mode, I would get an error
message from image's `attach` function:

```
Error executing vim.schedule lua callback: ...cal/share/nvim/lazy/snacks.nvim/lua/snacks/image/doc.lua:215: scoped variable: Invalid buffer id: 88
stack traceback:
        [C]: in function '__index'
        ...cal/share/nvim/lazy/snacks.nvim/lua/snacks/image/doc.lua:215: in function 'attach'
        ...al/share/nvim/lazy/snacks.nvim/lua/snacks/image/init.lua:174: in function <...al/share/nvim/lazy/snacks.nvim/lua/snacks/image/init.lua:173>
```

Looks like by the time the `attach` function is called, the buffer is no
longer valid. This is caused by using `vim.schedule`, which introduces a
small delay, during which the buffer can be deleted.

I suspect this is related to blink.cmp, but I cannot tell for certain.

**Solution**: Make sure that the buffer is valid using
`vim.api.nvim_buf_is_valid` inside the `vim.schedule` callback, before
calling `attach`.

With this fix, the error does not show up anymore.

## Screenshots

I used to get this error when entering Insert mode:

<img width="1474" alt="image"
src="https://github.com/user-attachments/assets/e256a36a-7ff6-4f84-8cdf-9e7b8132a3a1"
/>
2025-02-17 13:28:37 +01:00
Folke Lemaitre
ad0b88dc08
feat(image): added opts.img_dirs to configure the search path for resolving images. Closes #1222 2025-02-17 13:12:44 +01:00
Folke Lemaitre
1bca71a133
feat(image): added support for math expressions in latex and markdown doc + images in latex. Closes #1223 2025-02-17 12:50:35 +01:00
Folke Lemaitre
0bf0c6223d
feat(image): refactor of treesitter queries to support inline image data 2025-02-17 12:49:38 +01:00
Folke Lemaitre
a596f8a9ea
feat(image): added support for a bunch of aditional languages 2025-02-16 14:16:15 +01:00
Folke Lemaitre
118eab0cfd
fix(image): return converted filename instead of original src. Closes #1213 2025-02-16 12:19:24 +01:00
Folke Lemaitre
d18680c931
docs: docgen 2025-02-16 09:23:16 +01:00
Folke Lemaitre
ab0ba5cb22
feat(image): added support for tsx, jsx, vue and angular 2025-02-16 09:21:09 +01:00
Folke Lemaitre
d41704f3da
feat(image): url_decode strings 2025-02-16 09:09:23 +01:00
Folke Lemaitre
14a1f32eaf
feat(image): added support for angle bracket urls. Closes #1209 2025-02-16 08:55:53 +01:00
Folke Lemaitre
6348ccf120
feat(image): added Snacks.image.doc.at_cursor(). See #1108 2025-02-16 08:50:52 +01:00
Folke Lemaitre
3fda27200d
feat(image): added support for wikilink style images. Closes #1210 2025-02-16 08:45:29 +01:00
Folke Lemaitre
86e3ddf2e4
fix(image): handle inline images at the same TS node, but that changed url. See #1203 2025-02-15 22:50:17 +01:00
Folke Lemaitre
942cb9291e
feat(image): make manual hover work correctly 2025-02-15 22:09:54 +01:00
Folke Lemaitre
356f6216b9
fix(image): handle file uppercase file extensions. Closes #1202 2025-02-15 22:05:28 +01:00
Folke Lemaitre
668cbbba47
feat(image): try resolving paths relative to the document and to the cwd. See #1203 2025-02-15 22:02:06 +01:00
Folke Lemaitre
59bbe8d90e
feat(image): added support for .image tags in neorg 2025-02-15 15:20:10 +01:00
Folke Lemaitre
c067ffe86c
fix(image): support Neovim < 0.10 2025-02-15 14:48:25 +01:00
Folke Lemaitre
5f466becd9
feat(image): Snacks.image.hover() 2025-02-15 14:46:03 +01:00
Folke Lemaitre
e35d6cd4ba
feat(image): refactor + css/html + beter image fitting 2025-02-15 14:28:49 +01:00