mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-05-06 05:22:23 +02:00
#115 - Fix for updating added categories/tags
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## [4.0.1] - 2021-09-24
|
||||
|
||||
- [#114](https://github.com/estruyf/vscode-front-matter/issues/114): Fix for categories/tags provided as string in YAML
|
||||
- [#115](https://github.com/estruyf/vscode-front-matter/issues/115): Fix for updating added categories/tags
|
||||
|
||||
## [4.0.0] - 2021-09-22 - [Release Notes](https://beta.frontmatter.codes/updates/v4_0_0)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { TaxonomyType } from '../models';
|
||||
import { SETTING_TAXONOMY_TAGS, SETTING_TAXONOMY_CATEGORIES, CONFIG_KEY } from '../constants';
|
||||
import { Folders } from '../commands/Folders';
|
||||
import { join, basename } from 'path';
|
||||
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
||||
import { existsSync, readFileSync, watch, writeFileSync } from 'fs';
|
||||
import { Extension } from './Extension';
|
||||
|
||||
export class Settings {
|
||||
@@ -38,12 +38,22 @@ export class Settings {
|
||||
* @param callback
|
||||
*/
|
||||
public static onConfigChange(callback: (global?: any) => void) {
|
||||
const projectConfig = Settings.projectConfigPath;
|
||||
|
||||
workspace.onDidChangeConfiguration(() => {
|
||||
callback();
|
||||
});
|
||||
|
||||
// Background listener for when it is not a user interaction
|
||||
if (projectConfig && existsSync(projectConfig)) {
|
||||
watch(projectConfig, () => {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
workspace.onDidSaveTextDocument(async (e) => {
|
||||
const filename = e.uri.fsPath;
|
||||
|
||||
if (Settings.checkProjectConfig(filename)) {
|
||||
const file = await workspace.openTextDocument(e.uri);
|
||||
if (file) {
|
||||
|
||||
Reference in New Issue
Block a user