Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LaTeX-Workshop
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
James-Yu
LaTeX-Workshop
Commits
b06e909e
Commit
b06e909e
authored
3 months ago
by
Jerome Lelong
Browse files
Options
Downloads
Patches
Plain Diff
Refactor latex.extraExts config to allow live changes
parent
5c821656
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/file.ts
+16
-7
16 additions, 7 deletions
src/core/file.ts
src/lw.ts
+0
-1
0 additions, 1 deletion
src/lw.ts
with
16 additions
and
8 deletions
src/core/file.ts
+
16
−
7
View file @
b06e909e
...
...
@@ -7,6 +7,7 @@ import { lw } from '../lw'
const
logger
=
lw
.
log
(
'
File
'
)
let
extraTeXExts
:
string
[]
export
const
file
=
{
tmpDirPath
:
''
,
getOutDir
,
...
...
@@ -31,6 +32,12 @@ export function initialize() {
file
.
tmpDirPath
=
createTmpDir
()
}
setExtraTeXExts
()
lw
.
onConfigChange
(
'
latex.extraExts
'
,
setExtraTeXExts
)
function
setExtraTeXExts
()
{
extraTeXExts
=
vscode
.
workspace
.
getConfiguration
(
'
latex-workshop
'
).
get
(
'
latex.extraExts
'
,
[])
as
string
[]
}
/**
* Creates a temporary directory and returns its path as a string.
*
...
...
@@ -87,8 +94,9 @@ function handleTmpDirError(error: Error) {
* This function verifies whether a provided file extension string matches any
* of the TeX-related extensions defined in several constant arrays. It
* consolidates these arrays into a single collection and checks if the given
* extension exists within this collection. The arrays include TeX extensions, R
* Sweave extensions, Julia Weave extensions, and Python Weave extensions.
* extension exists within this collection. The arrays include TeX extensions
* (including those defined by the user ), R Sweave extensions, Julia Weave extensions,
* and Python Weave extensions.
*
* @param {string} extname - The file extension to be checked including the dot
* (e.g., '.tex').
...
...
@@ -97,8 +105,8 @@ function handleTmpDirError(error: Error) {
*/
function
hasTeXExt
(
extname
:
string
):
boolean
{
return
[
...
extraTeXExts
,
...
lw
.
constant
.
TEX_EXT
,
...
lw
.
constant
.
EXTRA_TEX_EXT
,
...
lw
.
constant
.
RSWEAVE_EXT
,
...
lw
.
constant
.
JLWEAVE_EXT
,
...
lw
.
constant
.
PWEAVE_EXT
...
...
@@ -112,9 +120,10 @@ function hasTeXExt(extname: string): boolean {
* This function evaluates the given file extension and checks it against a
* predefined list of TeX source extensions such as `.tex`, `.ltx`, `.sty`,
* `.cls`, `.fd`, `.aux`, `.bbl`, `.blg`, `.brf`, `.log`, `.out`, and R Sweave
* extensions, Julia Weave extensions, and Python Weave extensions. It returns
* `true` if the extension is not found in this list, and `false` otherwise.
* This is useful for filtering out non-TeX files from a collection of files.
* extensions, Julia Weave extensions, Python Weave extensions and user defined
* tex extensions. It returns `true` if the extension is not found in this list,
* and `false` otherwise. This is useful for filtering out non-TeX files from a
* collection of files.
*
* @param {string} extname - The file extension to be checked including the dot
* (e.g., '.tex').
...
...
@@ -123,8 +132,8 @@ function hasTeXExt(extname: string): boolean {
*/
function
hasBinaryExt
(
extname
:
string
):
boolean
{
return
!
[
...
extraTeXExts
,
...
lw
.
constant
.
TEX_EXT
,
...
lw
.
constant
.
EXTRA_TEX_EXT
,
...
lw
.
constant
.
TEX_NOCACHE_EXT
,
...
lw
.
constant
.
RSWEAVE_EXT
,
...
lw
.
constant
.
JLWEAVE_EXT
,
...
...
This diff is collapsed.
Click to expand it.
src/lw.ts
+
0
−
1
View file @
b06e909e
...
...
@@ -60,7 +60,6 @@ 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
'
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment