Skip to content

Commit

Permalink
Latex scope migration
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed May 18, 2024
1 parent 2b6475e commit ba0db61
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
20 changes: 0 additions & 20 deletions packages/cursorless-engine/src/languages/latex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ const SECTIONING = [
"part",
];

const ENVIRONMENTS = [
"generic_environment",
"comment_environment",
"verbatim_environment",
"listing_environment",
"minted_environment",
"pycode_environment",
];

const sectioningText = SECTIONING.map((s) => `${s}[text]`);
const sectioningCommand = SECTIONING.map((s) => `${s}[command]`);

Expand Down Expand Up @@ -197,20 +188,9 @@ const nodeMatchers: Partial<
matcher(patternFinder(...sectioningText), unwrapGroupParens),
patternMatcher("begin[name][text]", "end[name][text]"),
),
functionCallee: "command_name",

collectionItem: matcher(patternFinder("enum_item"), extractItemContent),

part: "part",
chapter: "chapter",
section: "section",
subSection: "subsection",
subSubSection: "subsubsection",
namedParagraph: "paragraph",
subParagraph: "subparagraph",

environment: ENVIRONMENTS,
xmlElement: ENVIRONMENTS,
xmlBothTags: getTags,
xmlStartTag: getStartTag,
xmlEndTag: getEndTag,
Expand Down
19 changes: 19 additions & 0 deletions queries/latex.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,22 @@
(block_comment)
(line_comment)
] @comment

(command_name) @functionCallee

(part) @part
(chapter) @chapter
(section) @section
(subSection) @subsection
(subSubSection) @subsubsection
(namedParagraph) @paragraph
(subParagraph) @subparagraph

[
(generic_environment)
(comment_environment)
(verbatim_environment)
(listing_environment)
(minted_environment)
(pycode_environment)
] @environment @xmlElement

0 comments on commit ba0db61

Please sign in to comment.