Skip to content

Commit

Permalink
Add new config latex-workshop.latex.extraExts
Browse files Browse the repository at this point in the history
This variable lists all the file extensions that LW will consider as
LaTeX files.
  • Loading branch information
jlelong committed Nov 21, 2024
1 parent 40406ff commit 5c82165
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,15 @@
"default": "%DIR%",
"markdownDescription": "The directory where the extension tries to find project files (e.g., PDF and SyncTeX files) are located. Both relative and absolute paths are supported. Relative path start from the root file location, so beware if it is located in sub-directory. The path must not contain a trailing slash. The LaTeX toolchain should output files to this path. For a list of supported placeholders, please visit https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#placeholders. Note that if this config is set to %DIR% (default value) or %DIR_W32%, the extension will try to parse the last LaTeX tools used and look for `-out-directory=` and `-outdir=`, and automatically determine the output directory. This means that you can safely ignore this config if you use `latexmk` and do not manually `mv` the output files in your recipe."
},
"latex-workshop.latex.extraExts": {
"scope": "resource",
"type": "array",
"items": {
"type": "string"
},
"default": [],
"markdownDescription": "The list of extra file extensions to be considered as LaTeX files. The extension will parse these files for references and to provide intellisense."
},
"latex-workshop.latex.jobname": {
"scope": "resource",
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions src/core/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function handleTmpDirError(error: Error) {
function hasTeXExt(extname: string): boolean {
return [
...lw.constant.TEX_EXT,
...lw.constant.EXTRA_TEX_EXT,
...lw.constant.RSWEAVE_EXT,
...lw.constant.JLWEAVE_EXT,
...lw.constant.PWEAVE_EXT
Expand All @@ -123,6 +124,7 @@ function hasTeXExt(extname: string): boolean {
function hasBinaryExt(extname: string): boolean {
return ![
...lw.constant.TEX_EXT,
...lw.constant.EXTRA_TEX_EXT,
...lw.constant.TEX_NOCACHE_EXT,
...lw.constant.RSWEAVE_EXT,
...lw.constant.JLWEAVE_EXT,
Expand Down
3 changes: 2 additions & 1 deletion src/lw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const lw = {

const constant = {
TEX_EXT: ['.tex', '.bib'],
EXTRA_TEX_EXT: vscode.workspace.getConfiguration('latex-workshop').get('latex.extraExts', []) as string[],
TEX_NOCACHE_EXT: ['.cls', '.sty', '.bst', '.bbx', '.cbx', '.def', '.cfg'],
RSWEAVE_EXT: ['.rnw', '.Rnw', '.rtex', '.Rtex', '.snw', '.Snw'],
JLWEAVE_EXT: ['.jnw', '.jtexw'],
Expand All @@ -69,7 +70,7 @@ const constant = {
MAGIC_PROGRAM_ARGS_SUFFIX: '_WITH_ARGS',
MAX_PRINT_LINE: '10000',
/**
* Prefix that server.ts uses to distiguish requests on pdf files from
* Prefix that server.ts uses to distinguish requests on pdf files from
* others. We use '.' because it is not converted by encodeURIComponent and
* other functions.
* See https://stackoverflow.com/questions/695438/safe-characters-for-friendly-url
Expand Down

0 comments on commit 5c82165

Please sign in to comment.