bug: Elixir support #163
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
barrettruth/diffs.nvim#163
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Prerequisites
Neovim version
Operating system
MacOS
Description
Hi there,
This is a reopening of: https://github.com/barrettruth/diffs.nvim/issues/221
I would love to reopen that issue but the permissions on this repo don't actually allow just anyone to re-open issues so if you want people to be able to I think you need to adjust the permissions...
I can confirm that, using the repro script to ensure a clean install (ie I am like 99.9% sure there is not another plugin interfering here), I do not get treesitter highlighting in fugitive with this plugin when I'm working on elixir repos. I get it in other langs, but not elixir.
Here is a screenshot of an elixir project with git changes open using the clean repro script:
Let me know if there's any more info I can provide
Steps to reproduce
Health check
Minimal reproduction
The following reproduction is unable to create the problem. Run it from your shell. It clones the repo into
/tmpand runs neovim with--clean -u NONE.The likely issue is that your clean repro exposes parser .so files but not the nvim-treesitter runtime queries. Please check:
:lua for _, l in ipairs({ "elixir", "heex" }) do print(l, pcall(vim.treesitter.language.inspect, l), vim.treesitter.query.get(l, "highlights") ~= nil) endwhich should be all true. Also, try with other non-bundled languages.
I am highly suspicious that you just have some parser-path-treesitter-loading-funkiness going on in your configuration.
Once again, I am going to close this. If the following repro works and, of course, you agree with it, do not reopen the issue - feel free to comment and I'll respond, but this is more of a setup-debugging thing than a problem with diffs.nvim. If you think I'm fundamentally mistaken on something here, feel free to say so and I'll reopen.
sure I will test it, sorry if it was annoying to re-open it, I guess I should have just responded in the previous issue but I was concerned it would be easy to miss
all good
Unless your dotfiles are out of date, I found the problem/
You do this:
nvim-treesitter is deprecated mostly and now uses the main branch by default instead of master. The entire config setup via
require('nvim-treesitter.configs')is completely deprecated.auto_installandensure_installeddo nothing and the parsers are most definitely not found on your system.I'm going to close this finally. Given how many people use this plugin and that this has never cropped up for anyone else I'm fairly sure this is the problem.
Oh my god, wow thank you for going to the effort of going through my dotfiles! I am going to try that and let you know what I find out.
ok, some good news some bad news. good is I figured out the actual problem going on here. I simply had the global vim var where you setup this plugin in the wrong place. I put it after the plugin initialized, so it was never reading it.
the weirder or bad news is I had to do some weird stuff with filetypes to get it working right. at first, I got exs highlighting fine, but not ex files.
I ended up having to add this:
before they would highlight right in fugitive buffers, with the treesitter highlights from your plugin.
I asked claude why I would have highlighting when I actually view these files but not in fugitive, and it said this:
I gotta say I'm pretty confused by this, I had no idea vim had some way to parse the filetype that didn't just involve the filename. does this ring any bells to you?
lol "ok do it" I feel that XD
yeah id just ask claude:
run nvim --clean -u NORC and see if it picks up on .ex files being elizir filetype.
if it doesn't recognize it then thats the problem - and your fix is right.
id just triple check this - im 99% sure that the extension is recognized by (neo)vim
yeah I mean things work ok as long as I specify those filetypes, but I've used vim a long time and I've never had to do that. I had syntax highlighting when I would open an
exfile, but apparently when diffs.nvim was calling vim.filetype.match on the filename of a.exfile, it was returning nil.as you can see here I guess claude is saying that nvim itself has some kind of fallback that can determine the right filetype based on the actual content, but just the filetype alone is not gauranteed to always return the right value for ambiguous extensions?
maybe the plugin could start passing some additional args to that
matchfunction to prevent that? Like could it pass part of the file buffer or something?