Skip to content

Commit 883f3c3

Browse files
committed
Assume relative DefaultBib path is from workspaceFolder
1 parent 3be5ca4 commit 883f3c3

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [0.7.0] - 2020-03-17
4+
5+
- Remove support for `${workspaceFolder}` in bib path
6+
- If the path in `PandocCiter.DefaultBib` is relative, then it will be assumed that the path is relative to the workspaceFolder
7+
38
## [0.6.0] - 2020-03-17
49

510
- Support `${workspaceFolder}` in bib path (#13)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This extension provides autocompletion of citations stored in a bibtex file, for
2929
+ Function: This is useful if there are multiple markdown files with one external master file containing the YAML header with the `bibliography: [path/to/bib]` entry. This avoids having to insert the bibliography YAML header into each individual file.
3030
- `PandocCiter.DefaultBib`
3131
+ Type: String, absolute or relative path to bib file
32-
- Note: For relative paths, it will be assumed that the path is relative to the active document. If the path should be relative to the workspace folder, then use `${workspaceFolder}` in the configuration, e.g. `"PandocCiter.DefaultBib": "${workspaceFolder}/bibFolder/sources.bib"`
32+
- Note: For relative paths, it will be assumed that the path is relative to the workspace folder
3333
+ Function: This is useful if there is a default bib file that is preferred for all projects. This bib file will be loaded regardless of whether or not a YAML entry is included.
3434
- `PandocCiter.UseDefaultBib`
3535
+ Type: Boolean, default is `true`

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "pandocciter",
33
"displayName": "Pandoc Citer",
44
"description": "Autocomplete bibtex citations for markdown/pandoc",
5-
"version": "0.6.0",
5+
"version": "0.7.0",
66
"publisher": "notZaki",
77
"license": "MIT",
88
"engines": {

src/components/manager.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class Manager {
7777
}
7878
if (configuration.get('UseDefaultBib') && (configuration.get('DefaultBib') !== "")) {
7979
let bibFile = path.join(configuration.get('DefaultBib'));
80-
bibFile = this.resolveBibFile(bibFile);
80+
bibFile = this.resolveBibFile(bibFile, true);
8181
this.extension.log(`Looking for .bib file: ${bibFile}`);
8282
this.addBibToWatcher(bibFile);
8383
foundFiles.push(bibFile);
@@ -99,11 +99,12 @@ export class Manager {
9999
}
100100
}
101101

102-
resolveBibFile(bibFile: string) {
103-
bibFile = bibFile.replace("${workspaceFolder}",vscode.workspace.rootPath);
102+
resolveBibFile(bibFile: string, useWorkspaceFolder?: boolean) {
104103
if (path.isAbsolute(bibFile)) {
105104
return bibFile;
106-
} else {
105+
} else if (useWorkspaceFolder) {
106+
return path.resolve(vscode.workspace.rootPath, bibFile);
107+
} else {
107108
return path.resolve(path.dirname(vscode.window.activeTextEditor!.document.fileName), bibFile);
108109
}
109110
}

0 commit comments

Comments
 (0)