nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.48k stars 212 forks source link

Tangle local to codeblock doesn't support posix paths #983

Open jonathf opened 1 year ago

jonathf commented 1 year ago

Prerequisites

Neovim Version

NVIM v0.10.0-dev

Neorg setup

require("neorg").setup {
  load = {
    ["core.defaults"] = {}, -- Loads default behaviour
    ["core.completion"] = {config = {name = "norg", engine = "nvim-cmp"}},
  },
}

Actual behavior

Here is the norg code:

#tangle /home/jonathf/.config/file
@code lua
@end

#tangle ~/config/nvim/after/ftplugin/help.lua
@code lua
@end

Here is the treesitter tree:

(paragraph) ; [1:1 - 2:0]
 (strong_carryover_set) ; [1:1 - 8]
  (strong_carryover) ; [1:1 - 8]
   name: (tag_name) ; [1:2 - 7]
    (word) ; [1:2 - 7]
 (paragraph_segment) ; [1:9 - 34]
  (italic) ; [1:9 - 22]
(ranged_verbatim_tag) ; [2:1 - 3:4]
 name: (tag_name) ; [2:2 - 5]
  (word) ; [2:2 - 5]
 (tag_parameters) ; [2:7 - 9]
  (tag_param) ; [2:7 - 9]
 (ranged_verbatim_tag_end) ; [3:1 - 4]
(paragraph) ; [5:1 - 6:0]
 (strong_carryover_set) ; [5:1 - 9]
  (strong_carryover) ; [5:1 - 9]
   name: (tag_name) ; [5:2 - 7]
    (word) ; [5:2 - 7]
   (tag_parameters) ; [5:9 - 9]
    (tag_param) ; [5:9 - 9]
 (paragraph_segment) ; [5:10 - 45]
(ranged_verbatim_tag) ; [6:1 - 7:4]
 name: (tag_name) ; [6:2 - 5]
  (word) ; [6:2 - 5]
 (tag_parameters) ; [6:7 - 9]
  (tag_param) ; [6:7 - 9]
 (ranged_verbatim_tag_end) ; [7:1 - 4]

First tangle tag starts with italic since the first part of /home/jonathf/.config/file to norg is italic text. The second tangle tag does not, but the first ~ is ignored from the tree, which I guess that treesitter doesn't recognise it.

Expected behavior

I would like Neorg to recognize both tag paths so that they can be processed by tangle.

Steps to reproduce

Read file with the Norg content above, and run :InspectTree to see the query tree.

Help

Yes

Implementation help

I can add code in the lua plugin ecosystem, but I am inexperiences with treesitter scheme if that is where we are heading.

vhyrro commented 1 year ago

Ah this is a known issue because of the V1 parser. I'm close to releasing the first release version of the V3 parser which should be much better overall :)

jonathf commented 1 year ago

Good to hear. Mind pointing me in the direction of the v3 parser work (if it is published/in a pr)?

vhyrro commented 1 year ago

Here ya go: https://github.com/nvim-neorg/tree-sitter-norg3