-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(section | ||
text: [(curly_group (text) @name) (_)] @name | ||
) @type | ||
(subsection | ||
text: [(curly_group (text) @name) (_)] @name | ||
) @type | ||
(subsubsection | ||
text: [(curly_group (text) @name) (_)] @name | ||
) @type | ||
(generic_environment | ||
begin: (begin | ||
name: [(curly_group_text text: (text) @name) (_)] @name | ||
)) @type | ||
|
||
(new_command_definition | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
stevearc
Author
Owner
|
||
declaration: [(curly_group_command_name command: (command_name) @name) (_)] @name | ||
) @type | ||
|
||
(title_declaration | ||
text: [(curly_group (text) @name) (_)] @name | ||
) @type | ||
(author_declaration | ||
authors: [(curly_group_author_list (author) @name) (_)] @name | ||
) @type |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
local util = require("tests.test_util") | ||
|
||
describe("treesitter latex", function() | ||
it("parses all symbols correctly", function() | ||
util.test_file_symbols("treesitter", "./tests/treesitter/latex_test.tex", { | ||
{ | ||
kind = "Function", | ||
name = "\\abs", | ||
level = 0, | ||
lnum = 3, | ||
col = 0, | ||
end_lnum = 3, | ||
end_col = 38, | ||
}, | ||
{ | ||
kind = "Field", | ||
name = "Title: Lorem Ipsum", | ||
level = 0, | ||
lnum = 5, | ||
col = 0, | ||
end_lnum = 5, | ||
end_col = 19, | ||
}, | ||
{ | ||
kind = "Field", | ||
name = "Authors: John Doe", | ||
level = 0, | ||
lnum = 6, | ||
col = 0, | ||
end_lnum = 6, | ||
end_col = 17, | ||
}, | ||
{ | ||
kind = "Class", | ||
name = "document", | ||
level = 0, | ||
lnum = 8, | ||
col = 0, | ||
end_lnum = 24, | ||
end_col = 14, | ||
children = { | ||
{ | ||
kind = "Method", | ||
name = "First section", | ||
level = 1, | ||
lnum = 10, | ||
col = 0, | ||
end_lnum = 20, | ||
end_col = 24, | ||
children = { | ||
{ | ||
kind = "Method", | ||
name = "A subsection", | ||
level = 2, | ||
lnum = 14, | ||
col = 0, | ||
end_lnum = 20, | ||
end_col = 24, | ||
children = { | ||
{ | ||
kind = "Method", | ||
name = "A subsubsection", | ||
level = 3, | ||
lnum = 18, | ||
col = 0, | ||
end_lnum = 20, | ||
end_col = 24, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
kind = "Method", | ||
name = "This is another subsection", | ||
level = 1, | ||
lnum = 22, | ||
col = 0, | ||
end_lnum = 22, | ||
end_col = 36, | ||
}, | ||
}, | ||
}, | ||
}) | ||
end) | ||
end) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
& tex | ||
|
||
\newcommand*{\abs}[1]{\left|#1\right|} | ||
|
||
\title{Lorem Ipsum} | ||
\author{John Doe} | ||
|
||
\begin{document} | ||
|
||
\section{First section} | ||
|
||
This is a section. | ||
|
||
\subsection{A subsection} | ||
|
||
This is a subsection. | ||
|
||
\subsubsection{A subsubsection} | ||
|
||
This is a subsubsection. | ||
|
||
\section{This is another subsection} | ||
|
||
\end{document} |
I don't think you should include this as one of the items:
for me, there are tons of
\newcommand
andDeclareMathOperator
, etc.