From afe93c727f3c0ca95cd9d66e4f0efc79da3779fc Mon Sep 17 00:00:00 2001 From: James Yu Date: Fri, 12 Apr 2024 11:03:53 +0100 Subject: [PATCH] Fix #4227 Ignore label defs in `xparse` macros --- src/completion/completer/reference.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/completion/completer/reference.ts b/src/completion/completer/reference.ts index 06721230d..33ba96511 100644 --- a/src/completion/completer/reference.ts +++ b/src/completion/completer/reference.ts @@ -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 [] }