tree-sitter-vim icon indicating copy to clipboard operation
tree-sitter-vim copied to clipboard

fix(ranges): parse ranges for all command

Open Sam-programs opened this issue 1 year ago • 5 comments

'<,'>s/foo/bar errors:

(script_file [0, 0] - [1, 0]
  (range_statement [0, 0] - [0, 5]
    start: (mark [0, 0] - [0, 2])
    end: (mark [0, 3] - [0, 5]))
  (ERROR [0, 5] - [0, 14]
    (marker_definition [0, 7] - [0, 14])))

after:

(script_file [0, 0] - [1, 0]
  (unknown_builtin_statement [0, 0] - [0, 14]
    start: (mark [0, 0] - [0, 2])
    end: (mark [0, 3] - [0, 5])
    (unknown_command_name [0, 5] - [0, 6])
    (arguments [0, 6] - [0, 14]
      (command_argument [0, 6] - [0, 14]))))

I don't know if parsing ranges before all commands has issues though.

Sam-programs avatar Mar 14 '24 12:03 Sam-programs

Please commit the generated parser.c (and other files).

clason avatar Mar 14 '24 12:03 clason

I forgot to make them optional ...

Sam-programs avatar Mar 14 '24 12:03 Sam-programs

I forgot to make them optional ...

I ran into another problem, since the ending ("/") in range marks were optional statements that used an range in pattern ranges would result in errors. ( and commands also in my case) /acall/

(script_file [0, 0] - [1, 0]
  (range_statement [0, 0] - [0, 2]
    start: (pattern [0, 1] - [0, 2]))
  (ERROR [0, 2] - [0, 6]))

image

I think they were optional because range statements don't need to end, which is why i kept _range for range statements and made a new _complete_range for commands and statements.

Sam-programs avatar Mar 14 '24 15:03 Sam-programs

~~I am running make and nothing is changing, and the artifact seems related to matchparen?~~ Never mind i missed the drop down.

Sam-programs avatar Mar 15 '24 02:03 Sam-programs

Hey @clason i have 2 questions. Should i rebase this off of fix_ci ? I want to add a query for ranges do i add it in this pr or do i open another one?

Sam-programs avatar Mar 16 '24 16:03 Sam-programs