Skip to content

Slides are unimplemented in treesitter, Indent segments are buggy (indent/conceal) #1732

@LunarLambda

Description

@LunarLambda

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

v0.11.3 (also tested latest nightly, same result)

Neorg setup

return {
    "nvim-neorg/neorg",
    lazy = false,
    build = ':silent Neorg sync-parsers',
    version = "*",
    opts = {
        load = {
            ["core.defaults"] = {},
            ["core.concealer"] = {
                config = {
                    icon_preset = 'diamond',
                }
            },
        },
    },
}

Actual behavior

Slide syntax yields an ERROR token in the treesitter tree, so seemingly entirely unimplemented:

* Heading

  - :
  Hello, world!
(document ; [0, 0] - [4, 0]
  (heading1 ; [0, 0] - [4, 0]
    (heading1_prefix) ; [0, 0] - [0, 2]
    title: (paragraph_segment) ; [0, 2] - [0, 9]
    content: (generic_list ; [2, 2] - [4, 0]
      (unordered_list1 ; [2, 2] - [4, 0]
        (unordered_list1_prefix) ; [2, 2] - [2, 4]
        (ERROR) ; [2, 4] - [3, 0]
        content: (paragraph ; [3, 2] - [4, 0]
          (paragraph_segment)))))) ; [3, 2] - [3, 15]

Indent segments are recognized but indent oddly:

* Heading

  - ::
  This is a paragraph with some text
    And a line in the paragraph

  And another paragraph
  @code lua
  print('hello world')
  @end

  - This is the next list item and terminates the indent segment.
(document ; [0, 0] - [12, 0]
  (heading1 ; [0, 0] - [12, 0]
    (heading1_prefix) ; [0, 0] - [0, 2]
    title: (paragraph_segment) ; [0, 2] - [0, 9]
    content: (generic_list ; [2, 2] - [12, 0]
      (unordered_list1 ; [2, 2] - [11, 0]
        (unordered_list1_prefix) ; [2, 2] - [2, 4]
        (indent_segment1 ; [2, 4] - [11, 0]
          (indent_segment_begin) ; [2, 4] - [3, 0]
          (paragraph ; [3, 2] - [4, 31]
            (paragraph_segment) ; [3, 2] - [3, 36]
            (paragraph_segment)) ; [4, 4] - [4, 31]
          (paragraph ; [6, 2] - [7, 0]
            (paragraph_segment)) ; [6, 2] - [6, 23]
          (ranged_verbatim_tag ; [7, 2] - [9, 6]
            name: (tag_name ; [7, 3] - [7, 7]
              (word)) ; [7, 3] - [7, 7]
            (tag_parameters ; [7, 8] - [7, 11]
              (tag_param)) ; [7, 8] - [7, 11]
            content: (ranged_verbatim_tag_content ; [8, 2] - [9, 0]
              (chunk ; [8, 2] - [9, 0]
                (function_call ; [8, 2] - [8, 22]
                  name: (identifier) ; [8, 2] - [8, 7]
                  arguments: (arguments ; [8, 7] - [8, 22]
                    (string ; [8, 8] - [8, 21]
                      content: (string_content)))) ; [8, 9] - [8, 20]
                (paragraph_segment))) ; [8, 2] - [8, 22]
            (ranged_verbatim_tag_end)))) ; [9, 2] - [9, 6]
      (unordered_list1 ; [11, 2] - [12, 0]
        (unordered_list1_prefix) ; [11, 2] - [11, 4]
        content: (paragraph ; [11, 4] - [12, 0]
          (paragraph_segment)))))) ; [11, 4] - [11, 65]

And quotes similarly indent oddly, but also do not conceal correctly either:

Image
    content: (quote ; [13, 2] - [23, 0]
      (quote1 ; [13, 2] - [21, 0]
        (quote1_prefix) ; [13, 2] - [13, 4]
        (indent_segment1 ; [13, 4] - [21, 0]
          (indent_segment_begin) ; [13, 4] - [14, 0]
          (paragraph ; [14, 2] - [16, 0]
            (paragraph_segment) ; [14, 2] - [14, 7]
            (paragraph_segment)) ; [15, 4] - [15, 23]
          (ranged_verbatim_tag ; [16, 2] - [18, 6]
            name: (tag_name ; [16, 3] - [16, 7]
              (word)) ; [16, 3] - [16, 7]
            (tag_parameters ; [16, 8] - [16, 11]
              (tag_param)) ; [16, 8] - [16, 11]
            content: (ranged_verbatim_tag_content ; [17, 2] - [18, 0]
              (chunk ; [17, 2] - [18, 0]
                (comment ; [17, 2] - [17, 21]
                  content: (comment_content)) ; [17, 4] - [17, 21]
                (paragraph_segment))) ; [17, 2] - [17, 21]
            (ranged_verbatim_tag_end)) ; [18, 2] - [18, 6]
          (paragraph ; [19, 2] - [19, 14]
            (paragraph_segment)))) ; [19, 2] - [19, 14]
      (quote1 ; [21, 2] - [23, 0]
        (quote1_prefix) ; [21, 2] - [21, 4]
        content: (paragraph ; [21, 4] - [23, 0]
          (paragraph_segment) ; [21, 4] - [21, 26]
          (paragraph_segment)))))) ; [22, 4] - [22, 8]

Expected behavior

Seeing as slides and indent segments can only occur in list items or quotes (as of the current spec), I would expect indentation to account for this accordingly (It seems to correctly indent only subsequent lines in a paragraph currently)

In other words, I would like the entire construct to show up as so, same as for regular list items:

  - ::
    This is a paragraph with some text
    And a line in the paragraph

    And another paragraph
    @code lua
    print('hello world')
    @end
  - This is the next list item and terminates the indent segment.

For quotes, concealing them as usual should be possible assuming the indentation is fixed.

Steps to reproduce

See above

Potentially conflicting plugins

None

Other information

No response

Help

None

Implementation help

I may be able to submit a PR for the indentation fix but I only have limited time currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues related to bugs. Please attach a severity, a priority and category with this label.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions