Skip to content

Commit

Permalink
Fix #4215 Use kpsewhich.class.enabled and `kpsewhich.bibtex.enabled…
Browse files Browse the repository at this point in the history
…` to control `kpsewhich`
  • Loading branch information
James-Yu committed Apr 15, 2024
1 parent afe93c7 commit 68c5e74
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## Unreleased

### Fixed
- (#4215) Use `kpsewhich.class.enabled` and `kpsewhich.bibtex.enabled` to control `kpsewhich`.
- Replaces `kpsewhich.enabled`.
- (#4227) Ignore label defs in `xparse` macros.

## [9.19.2] - 2024-04-04

### Fixed
Expand Down
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,19 @@
"scope": "window",
"type": "boolean",
"default": true,
"markdownDescription": "Use kpsewhich as defined by `#latex-workshop.kpsewhich.path#` to resolve latex class and bibliography file paths for intellisense parsing."
"markdownDeprecationMessage": "**Deprecated**: Please use `#latex-workshop.kpsewhich.class.enabled#` and `#latex-workshop.kpsewhich.bibtex.enabled#` instead."
},
"latex-workshop.kpsewhich.class.enabled": {
"scope": "window",
"type": "boolean",
"default": true,
"markdownDescription": "Use kpsewhich as defined by `#latex-workshop.kpsewhich.path#` to resolve latex class paths for intellisense parsing."
},
"latex-workshop.kpsewhich.bibtex.enabled": {
"scope": "window",
"type": "boolean",
"default": true,
"markdownDescription": "Use kpsewhich as defined by `#latex-workshop.kpsewhich.path#` to resolve bibliography file paths for intellisense parsing."
},
"latex-workshop.latex.bibDirs": {
"scope": "window",
Expand Down
2 changes: 1 addition & 1 deletion src/completion/completer/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function toPackageObj(packageName: string, options: string[], node?: Ast.Node):
}
let pkgObj: {[pkgName: string]: string[]} = {}
if (node?.type === 'macro' && node.content === 'documentclass') {
if (vscode.workspace.getConfiguration('latex-workshop').get('kpsewhich.enabled') as boolean) {
if (vscode.workspace.getConfiguration('latex-workshop').get('kpsewhich.class.enabled') as boolean) {
const clsPath = lw.file.kpsewhich([`${packageName}.cls`])
if (clsPath && fs.existsSync(clsPath)) {
pkgObj = parseContent(fs.readFileSync(clsPath).toString())
Expand Down
2 changes: 1 addition & 1 deletion src/core/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function getBibPath(bib: string, baseDir: string): string[] {
const bibPath = bib.includes('*') ? utils.resolveFileGlob(searchDirs, bib, '.bib') : utils.resolveFile(searchDirs, bib, '.bib')

if (bibPath === undefined || bibPath.length === 0) {
if (configuration.get('kpsewhich.enabled')) {
if (configuration.get('kpsewhich.bibtex.enabled')) {
const kpsePath = kpsewhich(['-format=.bib', bib])
return kpsePath ? [ kpsePath ] : []
} else {
Expand Down

0 comments on commit 68c5e74

Please sign in to comment.