Telescope lean_abbreviations fails: abbreviations.load() resolves abbreviations.json relative to its caller
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in lua/lean/abbreviations.lua at abbreviations.load() and compare its path resolution with the lua/telescope/_extensions/lean_abbreviations.lua caller. Reproduce with :Telescope lean_abbreviations before any insert-mode abbreviation expansion, then verify that the picker loads abbreviations.json on its first call and that insert-mode expansion still works.
Written by the indexing model from the issue text.
Description
:Telescope lean_abbreviations fails with:
E5108: Lua: .../lean.nvim/lua/lean/abbreviations.lua:29: Unable to read abbreviations from ".../lean.nvim/lua/telescope/_extensions/../../vscode-lean/abbreviations.json"
abbreviations.load() builds the path to abbreviations.json from debug.getinfo(2, 'S'), i.e. from the source file of its caller rather than of abbreviations.lua itself:
When the caller lives in lua/lean/ (e.g. insert-mode expansion), ../../vscode-lean resolves to the repository root and everything works. When the caller is the telescope extension in lua/telescope/_extensions/, the path resolves to lua/vscode-lean/abbreviations.json, which doesn't exist.
Because the result is memoized, the picker does work once something under lua/lean/ has already called load() in the session (e.g. after typing \a once in insert mode). So it only fails when the picker is the first thing to load the abbreviations.
Reproduction
- Start Neovim and open a
.leanfile. - Without typing any abbreviation first, run
:Telescope lean_abbreviations.
Suggested fix
Use level 1, so the path is relative to abbreviations.lua regardless of the caller:
local this_dir = vim.fs.dirname(debug.getinfo(1, 'S').source:sub(2))
Environment
- lean.nvim 527b47e (main)
- telescope.nvim 40aedd8
- Neovim 0.12.5, macOS
- Dominant language
- Lua
- Stars
- 597
- Forks
- 60
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Julian/lean.nvim
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in Julian/lean.nvim
Similar issues
-
agent-research-finding bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jordansmall/nixvim-config#99 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
xmake-io/xmake#7822 · 3 comments ·
Maintainers usually reply within 2 days
-
omarchy-menu-keybindings lua bind scan spins at 100% CPU when user config iterates a mocked hl APIOpen
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
omacom/omarchy#14302 · 1 comment ·
Maintainers usually reply within 1 day
-
BUG
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
linuxmint/cinnamon-spices-applets#9091 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
PathOfBuildingCommunity/PathOfBuilding-PoE2#2560 ·
Maintainers usually reply within 4 days