Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace get_filetype with vim.filetype.match #982

Merged
merged 2 commits into from
Jul 7, 2023

Conversation

jonathf
Copy link
Contributor

@jonathf jonathf commented Jul 7, 2023

utils.get_filetype doesn't seem to work in autocmd like BufWritePre and BufWritePost, which is a real problem if you like to set up auto-tangle.

Fortunatly, neovim 0.8 introduce vim.filetype.match that does the same natively without issues.

Since the complexity of get_filetype has become trivial, I've deprecated the function.

`utils.get_filetype` doesn't seem to work in autocmd like `BufWritePre` and
`BufWritePost`, which is a real problem if you like to set up
auto-tangle.

Fortunatly, neovim 0.8 introduce `vim.filetype.match` that does the same
natively without issues.

Since the complexity of `get_filetype` has become trivial, I've deprecated
the function.
@vhyrro
Copy link
Member

vhyrro commented Jul 7, 2023

Awesome, thank you! Could you please run stylua on the code to keep things consistent? There's a makefile providing a make format for this :D

Be sure to have stylua installed with lua5.2 features: cargo install stylua --features lua52

@jonathf
Copy link
Contributor Author

jonathf commented Jul 7, 2023

Of course.

Looks like the linter is complaining now. I ran luacheck locally, I don't have the same issue. In fact, I don't think the error it is seeing there is really there. Might this be a caching issue perhaps?

@vhyrro
Copy link
Member

vhyrro commented Jul 7, 2023

I'll take a look at the linter later on, it could just be confused haha. Thank you again!

@vhyrro vhyrro changed the title fix: Replace get_filetype with vim.filetype.match fix: replace get_filetype with vim.filetype.match Jul 7, 2023
@vhyrro vhyrro merged commit 4e6dbb1 into nvim-neorg:main Jul 7, 2023
1 of 2 checks passed
@jonathf jonathf deleted the filetype branch July 7, 2023 13:29
benlubas pushed a commit to benlubas/neorg that referenced this pull request Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants