Commit graph

23 commits

Author SHA1 Message Date
Folke Lemaitre
5faed2f7ab
fix(util.job): use nvim_win_set_cursor instead of gg 2025-10-28 10:28:08 +01:00
Folke Lemaitre
52f30a198a
fix(util.lsp): Snacks.util.lsp.on() should trigger for each lsp client per buffer
Some checks are pending
CI / ci (push) Waiting to run
2025-10-28 00:31:52 +01:00
Folke Lemaitre
ce9e2993dd
feat(util): Snacks.util.stop() to safely stop/close a luv handle 2025-10-28 00:14:17 +01:00
Folke Lemaitre
5589c9d355
feat(util.spawn): Proc:json() 2025-10-28 00:14:17 +01:00
Folke Lemaitre
b5441575e0
fix(util.job): scroll to top when process exits 2025-10-28 00:14:17 +01:00
Folke Lemaitre
d7caea32ab
style(picker): better debug/errors when running commands 2025-10-26 20:37:31 +01:00
Folke Lemaitre
221d4b1747
fix(util.job): stop when attached buffer is no longer valid 2025-10-26 20:19:23 +01:00
Folke Lemaitre
c956b37246
fix(util.job): stop on BufWipeout and BufDelete 2025-10-26 20:11:40 +01:00
Folke Lemaitre
17033e67ef
fix(util): color() should not create hl groups 2025-10-26 20:11:19 +01:00
Folke Lemaitre
de05631e6a
feat(util.job): simple wrapper around jobstart to work with terminals (used in dashboards and pickers) 2025-10-26 11:48:30 +01:00
Folke Lemaitre
f33aa2017a
feat(util.lsp): added overload for Snacks.util.lsp.on(cb)
Some checks are pending
CI / ci (push) Waiting to run
2025-10-25 19:06:26 +02:00
Folke Lemaitre
7a63ba5d37
feat(util): add LSP utility module with dynamic capability handlers
Add `Snacks.util.lsp.on()` to register handlers that fire when LSP clients
attach with specific capabilities. Supports filtering by:
- LSP method/capability
- Client name
- Buffer ID
- Any vim.lsp.get_clients() filter

Features:
- Handles both LspAttach and client/registerCapability events
- Ensures handlers only fire once per buffer
- Lazy-loaded via Snacks.util metatable

This provides a foundation for LSP-aware features like conditional keymaps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 16:31:13 +02:00
Folke Lemaitre
774bf9d8c8
fix(util): only use mini.icons if it has been setup. Closes #2199 2025-10-20 17:53:11 +02:00
nickx00
7a5eb1036a
fix(explorer): mounted directories being detected as non-directories in Tree:expand (#2053)
## Description

In certain filesystems — such as bind mounts, NFS, FUSE, or other
mounted paths — uv.fs_scandir_next() may return a nil type for valid
directories. This causes the snacks.nvim explorer to treat mounted
folders as files, making them unexpandable in the UI.

This patch adds a fallback to resolve the correct type when
fs_scandir_next() returns nil. It uses uv.fs_stat() first, and falls
back to vim.fn.isdirectory() if needed.

This ensures that mounted directories are properly marked as navigable.

Code change summary:

- Inside Tree:expand, we now check t == nil
- If so, we call uv.fs_stat() to get the true type
- If fs_stat fails, we fallback to vim.fn.isdirectory
- Final dir = true logic remains intact

Impact:
- Fixes a long-standing bug in mounted directories under /mnt, FUSE,
etc.
- Only runs extra checks when needed (no performance hit for regular
files)
- No changes elsewhere — clean, isolated patch

## Related Issue(s)
  - Fixes #2036

## Screenshots

before:
<img width="1907" height="946" alt="image"
src="https://github.com/user-attachments/assets/15e1b8a5-c999-49e8-8ab5-1d23c60e4969"
/>

after:
<img width="343" height="902" alt="Screenshot_20250715_222920"
src="https://github.com/user-attachments/assets/c7ca2fa0-e0cc-4e3d-a4bb-5345538408f7"
/>

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-09-25 12:45:01 +02:00
Alexander Siryk
32e5bf1730
fix(util): fix invalid window error (#1996)
## Description

Add check if win id is valid to prevent errors when opening buffers
using Harpoon, or Diffview.

## Related Issue(s)

- Fixes #1968

## Screenshots

<img width="1391" alt="image"
src="https://github.com/user-attachments/assets/daa8cbd1-7104-4c5d-8cae-d50a900b6c76"
/>

<img width="1690" alt="image"
src="https://github.com/user-attachments/assets/6dd9cae6-fc3f-4a5e-b5ae-6fc1e4afeeca"
/>
2025-09-17 08:23:19 +02:00
Folke Lemaitre
6917597f6d
fix(util.spawn): correctly mark as faild on abort 2025-03-01 07:54:16 +01:00
Folke Lemaitre
9f0aa20489
feat(util): small ts parse wrapper that parses async when available 2025-03-01 07:53:55 +01:00
Folke Lemaitre
e2cb9df7d0
feat(util): util method to check if ts lang is available on any Neovim version. See #1422 2025-02-25 15:25:48 +01:00
Folke Lemaitre
1adfd29af3
feat(image): better error handling + option to disable error notifications 2025-02-18 22:54:24 +01:00
Folke Lemaitre
004050c435
feat(image): images are now properly scaled based on device DPI and image DPI. Closing #1257 2025-02-18 16:31:37 +01:00
Folke Lemaitre
5a37d83897
fix(image): failed state 2025-02-18 00:17:05 +01:00
Folke Lemaitre
b65178b470
feat(image): show progress indicator when converting image files 2025-02-17 23:56:55 +01:00
Folke Lemaitre
a76fe13148
feat(util): util.spawn 2025-02-17 23:12:54 +01:00