Comments (26)
That is the expected behavior.
from nvim-treesitter.
Sorry in the issue I forgot a few backticks. I edited it.
Shouldn't fenced code blocks work with INI?
from nvim-treesitter.
Yes, and it does for me. Check :InspectTree
(press I
to show injected language names).
from nvim-treesitter.
For that command I get:
(section) ; [1:1 - 5:0] markdown
(fenced_code_block) ; [1:1 - 5:0] markdown
(fenced_code_block_delimiter) ; [1:1 - 3] markdown
(info_string) ; [1:4 - 6] markdown
(language) ; [1:4 - 6] markdown
(block_continuation) ; [2:1 - 0] markdown
(code_fence_content) ; [2:1 - 4:0] markdown
(block_continuation) ; [3:1 - 0] markdown
(block_continuation) ; [4:1 - 0] markdown
(fenced_code_block_delimiter) ; [4:1 - 3] markdown
from nvim-treesitter.
Can you test the latest Neovim nightly? And do other languages work in injections?
from nvim-treesitter.
I tested bash
, sh
, nu
(nushell/tree-sitter-nu
), js
, py
. Those seem to work fine.
I could test nightly later on. Does it only work for nightly?
from nvim-treesitter.
No; it should just work as ini
is the language name. Just trying to bisect the differences between my working setup and yours.
from nvim-treesitter.
Sorry but where is your working setup? Do you have some Neovim config repo?
from nvim-treesitter.
No, it's bog-standard; nothing special. Since you have the issue, you should try to create a minimal reproducible config I can test with nvim --clean -u test.lua
.
from nvim-treesitter.
And the ini
parser is in fact installed properly? (Don't trust checkhealth; look for ini.so
.)
from nvim-treesitter.
(Your minimal config uses the standard lazy path so will likely conflict with your installed plugins. There's zero reason to use Lazy for a minimal repro -- just clone nvim-treesitter itself and add the path to rtp
.)
from nvim-treesitter.
(Sorry deleted the comment by accident before. A repost.)
Here's a minimal reproducible config for me. In init.lua
:
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
require('lazy').setup({
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
local configs = require('nvim-treesitter.configs')
configs.setup({
ensure_installed = {
'ini',
'markdown',
'javascript',
},
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end,
})
In foo.md
:
```ini
[section]
foo = bar
```
```js
const foo = 1
```
I run this with:
$ /usr/bin/nvim --clean -u init.lua foo.md
A screenshot:
from nvim-treesitter.
(Your minimal config uses the standard lazy path so will likely conflict with your installed plugins. There's zero reason to use Lazy for a minimal repro -- just clone nvim-treesitter itself and add the path to
rtp
.)
I tried your suggestion. I cloned the repo to a temporary directory. Here's my new config file:
vim.opt.runtimepath:prepend("/run/user/1000/nvim/nvim-treesitter")
require("nvim-treesitter.configs").setup({
ensure_installed = {
"ini",
"markdown",
"markdown_inline",
"javascript",
},
sync_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
})
The same thing occurs.
I see these .so
files in /run/user/1000/nvim/nvim-treesitter/parser/
:
ini.so
javascript.so
markdown_inline.so
markdown.so
from nvim-treesitter.
It also works for me, stable or nightly, so I think the problem is something else here
from nvim-treesitter.
This happens to me even on Termux. INI seems to be the only language that doesn't work. Is there some way for me to dig deeper to see what the issue might be?
from nvim-treesitter.
Yes, try to compile the parser manually and see if it works via tree-sitter
CLI.
from nvim-treesitter.
Do you mean the INI parser? INI files themselves do get parsed correctly, just not inside Markdown files as code blocks.
If you mean the Markdown parser do I need to incorporate https://github.com/nvim-treesitter/nvim-treesitter/blob/11a3584b81c3249d2b6279305aee1c7ad273985a/queries/markdown/injections.scm somehow?
from nvim-treesitter.
Oh no I'm using the latest commit. I just linked that to make the link shorter. I fixed it.
from nvim-treesitter.
I don't know what to tell you then; I have literally zero idea how the behavior you describe is possible.
from nvim-treesitter.
This appears to be related to language aliases for me. I see some in
.javascriptreact
, ecma
, jsx
don't work, when js
and javascript
do.from nvim-treesitter.
Hmmm. Can you try adding ini = "ini"
to that list? Although that would be the reverse direction, and I don't see how that's relevant since you're not relying on an alias, ini
being the actual language name.
Does dosini
work in codeblocks for you?
from nvim-treesitter.
Adding ini = "ini"
doesn't work.
Neither dosini
nor confini
work. However for an ini
code block, I do get dosini
returned for metadata["injection.language"]
in
from nvim-treesitter.
Ah, ok. Yeah, that predicate has always been iffy. Can you try the injection queries from the main
branch? (Might need Nvim nightly.)
from nvim-treesitter.
I was always on the main
branch, but not on Neovim nightly. I could try it, but the next Neovim v0.10 is gonna be released soon anyway.
Is the main
branch compatible with Neovim stable? Although I'm confused why it works for you guys and not for me.
from nvim-treesitter.
main
branch is only intended to be used with neovim 0.10+ onwards, so you're in a land of your own there
from nvim-treesitter.
Ah sorry I meant I was using master
. I was a bit confused as there's both master
and main
. I just checked for a LazyGit update, and the commits it showed matches master
.
from nvim-treesitter.
Related Issues (20)
- Python: Current line dedented while typing slice (`:`) HOT 1
- TS Parser PHP errors with Invalid node type "anonymous_function_creation_expression" HOT 5
- Error in php files HOT 1
- Indentation module breaks auto indent in JS files HOT 2
- Cant Install Latex HOT 1
- Brewfile support HOT 1
- bug: [python] [indent] conditional return prematurely de-indents
- Vimdoc: concealed characters not hidden, replaced by box-drawing characters HOT 13
- multiple dollar signs in a line in a markdown file makes tree-sitter crash HOT 2
- Impossible pattern "~" @markup.heading.4 HOT 2
- Incorrect indenting using `ts=8:sw=3:noet` with old C codebase
- nvim-treesitter[cpp]: Failed to execute the following command: HOT 3
- Error in decoration provider treesitter/highlighter.line HOT 4
- TSEnable highlight html HOT 1
- I tried My very dear friend, i tried the solution in #3092 because I spent 2 hours on this problem. And it solved issue for ts. But not for html for some weird reason. HOT 1
- Highlighting Issue After Undo or Large Text Addition in Markdown Files HOT 1
- Error parsing kotlin files HOT 1
- Rust documentation comments (`///` and `//!`) get incorrectly highlighted HOT 1
- nvim-treesitter failed to update HOT 1
- Underlines should be removed or at least the option to remove them should exist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-treesitter.