mirror of
https://github.com/James-Yu/LaTeX-Workshop.git
synced 2025-01-07 09:47:04 +03:00
Resolve #3827 Consider \markdownInput as input
This commit is contained in:
parent
5542d22185
commit
8d65fd9d4f
@ -254,7 +254,7 @@ export class Completer implements vscode.CompletionItemProvider {
|
||||
provider = this.documentClass
|
||||
break
|
||||
case 'input':
|
||||
reg = /\\(input|include|subfile|subfileinclude|includegraphics|includesvg|lstinputlisting|verbatiminput|loadglsentries)\*?(?:\[[^[\]]*\])*{([^}]*)$/
|
||||
reg = /\\(input|include|subfile|subfileinclude|includegraphics|includesvg|lstinputlisting|verbatiminput|loadglsentries|markdownInput)\*?(?:\[[^[\]]*\])*{([^}]*)$/
|
||||
provider = this.input
|
||||
break
|
||||
case 'includeonly':
|
||||
|
@ -275,8 +275,7 @@ async function parseLaTeXSubFileCommand(node: latexParser.Command, config: LaTeX
|
||||
|
||||
let candidate: string | undefined
|
||||
// \input{sub.tex}
|
||||
if (['input', 'InputIfFileExists', 'include', 'SweaveInput',
|
||||
'subfile', 'loadglsentries'].includes(node.name.replace(/\*$/, ''))
|
||||
if (['input', 'InputIfFileExists', 'include', 'SweaveInput', 'subfile', 'loadglsentries', 'markdownInput'].includes(node.name.replace(/\*$/, ''))
|
||||
&& cmdArgs.length > 0) {
|
||||
candidate = resolveFile(
|
||||
[path.dirname(file),
|
||||
|
@ -16,7 +16,7 @@ interface MatchPath {
|
||||
}
|
||||
|
||||
export class InputFileRegExp {
|
||||
private readonly inputReg = /\\(?:input|InputIfFileExists|include|SweaveInput|subfile|loadglsentries|(?:(?:sub)?(?:import|inputfrom|includefrom)\*?{([^}]*)}))(?:\[[^[\]{}]*\])?{([^}]*)}/g
|
||||
private readonly inputReg = /\\(?:input|InputIfFileExists|include|SweaveInput|subfile|loadglsentries|markdownInput|(?:(?:sub)?(?:import|inputfrom|includefrom)\*?{([^}]*)}))(?:\[[^[\]{}]*\])?{([^}]*)}/g
|
||||
private readonly childReg = /<<(?:[^,]*,)*\s*child='([^']*)'\s*(?:,[^,]*)*>>=/g
|
||||
|
||||
/**
|
||||
|
5
test/fixtures/armory/build/markdown_base.tex
vendored
Normal file
5
test/fixtures/armory/build/markdown_base.tex
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
\documentclass{article}
|
||||
\usepackage{markdown}
|
||||
\begin{document}
|
||||
\markdownInput{sub.md}
|
||||
\end{document}
|
5
test/fixtures/armory/build/markdown_sub.md
vendored
Normal file
5
test/fixtures/armory/build/markdown_sub.md
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
## Sample
|
||||
sample
|
||||
|
||||
### Sample
|
||||
sample
|
@ -108,4 +108,13 @@ suite('Auto-build test suite', () => {
|
||||
const { type } = await test.auto(fixture, 'sub/s.tex', false, true)
|
||||
assert.strictEqual(type, 'onSave')
|
||||
})
|
||||
|
||||
test.run('auto build with markdownInput', async (fixture: string) => {
|
||||
await test.load(fixture, [
|
||||
{src: 'build/markdown_base.tex', dst: 'main.tex'},
|
||||
{src: 'build/markdown_sub.md', dst: 'sub.md'}
|
||||
])
|
||||
const { type } = await test.auto(fixture, 'sub.md')
|
||||
assert.strictEqual(type, 'onChange')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user