Giter VIP home page Giter VIP logo

Comments (13)

milanglacier avatar milanglacier commented on June 21, 2024 2

actually the following patch works for me:

But I don't know if this is too simple where a lot of cases are not taken into account. But for Python vs python, JSON vs json, R vs r, it just works.

diff --git a/lua/nvim-treesitter/query_predicates.lua b/lua/nvim-treesitter/query_predicates.lua
index d4726107..e48f3279 100644
--- a/lua/nvim-treesitter/query_predicates.lua
+++ b/lua/nvim-treesitter/query_predicates.lua
@@ -17,7 +17,7 @@ local non_filetype_match_injection_language_aliases = {

 local function get_parser_from_markdown_info_string(injection_alias)
   local match = vim.filetype.match { filename = "a." .. injection_alias }
-  return match or non_filetype_match_injection_language_aliases[injection_alias] or injection_alias
+  return match or non_filetype_match_injection_language_aliases[injection_alias] or injection_alias:lower()
 end

 local function error(str)

from nvim-treesitter.

milanglacier avatar milanglacier commented on June 21, 2024 1

Hmm, no, because we can't do optional queries. So let's go with your patch. Do you want to make a PR for it?

Ok. I can submit a PR for it.

from nvim-treesitter.

lucario387 avatar lucario387 commented on June 21, 2024

This is intended. See neovim/neovim#28546

from nvim-treesitter.

milanglacier avatar milanglacier commented on June 21, 2024

This is intended. See neovim/neovim#28546

But you can never ensure language name in markdown code block is lower case. Others who do not use neovim write markdown code block in other cases, and then you open that file and your neovim session just freezes...

from nvim-treesitter.

iphauman avatar iphauman commented on June 21, 2024

I have encountered the same issue and it is annoying which make me unable to view the file with infinite error message pops. I used command lua vim.treesitter.stop() to stop the error in order to correct the error...

from nvim-treesitter.

clason avatar clason commented on June 21, 2024

I cannot reproduce this on macOS. And it's important here to distinguish the codeblock annotation (which is case-insensitive) and the language/parser name in your config/on your hard-drive (which must be lower-case).

from nvim-treesitter.

milanglacier avatar milanglacier commented on June 21, 2024
Screen.Recording.2024-05-17.at.03.49.29.mov

Please let me know if this is clear enough. The minimal config file and the sample markdown file has been already provided in the issue.

It is worth to note that The r parser is automatically installed by nvim-treesitter, and it is r.so, but the code block name in the markdown is R, not r.

from nvim-treesitter.

milanglacier avatar milanglacier commented on June 21, 2024

I use the release from github, not from homebrew. I delete all the files from ~/.cache/nvim. And the issue is still there. Are there any other potential problems occurred?

from nvim-treesitter.

clason avatar clason commented on June 21, 2024

I'll have to investigate. It's a race condition (it doesn't happen if you :e the file after starting) that only appears with nvim-treesitter -- and only on master. If this is not an easy fix (which it looks like it isn't), then I'm afraid this will be "wontfix" and you are recommended to use the main branch on Nvim 0.10+.

from nvim-treesitter.

clason avatar clason commented on June 21, 2024

Thank you, I forgot that master still uses that kludge (it's obsolete with 0.10). Your fix is correct, but I'll see how to best deal with that in the deprecation PR.

from nvim-treesitter.

clason avatar clason commented on June 21, 2024

Hmm, no, because we can't do optional queries. So let's go with your patch. Do you want to make a PR for it? (Best to just lower the input argument, though, so the lookup also works.)

from nvim-treesitter.

milanglacier avatar milanglacier commented on June 21, 2024

you are recommended to use the main branch on Nvim 0.10+.

Thanks. Good to know that there is a main branch. Will definitely play around with the new main branch.

from nvim-treesitter.

clason avatar clason commented on June 21, 2024

Fixed by #6648

from nvim-treesitter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.