Skip to content

Commit

Permalink
Fix #4227 Ignore label defs in xparse macros
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Apr 12, 2024
1 parent 16b504e commit afe93c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/completion/completer/reference.ts
Expand Up @@ -133,7 +133,11 @@ function parse(cache: FileCache) {
function parseAst(node: Ast.Node, nodeStack: Ast.Node[], filePath: string, lines: string[], labelMacros: string[]): ReferenceItem[] {
let refs: ReferenceItem[] = []
if (node.type === 'macro' &&
['renewcommand', 'newcommand', 'providecommand', 'DeclareMathOperator', 'renewenvironment', 'newenvironment'].includes(node.content)) {
['renewcommand', 'newcommand', 'providecommand', 'DeclareMathOperator', 'renewenvironment', 'newenvironment',
'NewDocumentCommand', 'RenewDocumentCommand', 'ProvideDocumentCommand', 'DeclareDocumentCommand',
'NewDocumentEnvironment', 'RenewDocumentEnvironment', 'ProvideDocumentEnvironment', 'DeclareDocumentEnvironment',
'NewExpandableDocumentCommand', 'RenewExpandableDocumentCommand', 'ProvideExpandableDocumentCommand', 'DeclareExpandableDocumentCommand'
].includes(node.content)) {
// Do not scan labels inside \newcommand, \newenvironment & co
return []
}
Expand Down

0 comments on commit afe93c7

Please sign in to comment.