Skip to content

Commit 7875997

Browse files
authored
Merge pull request #1343 from pjkaufman/master
Fixed Ignore File and Folder Commands Not Working
2 parents 9c74ec1 + 9452115 commit 7875997

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export default class LinterPlugin extends Plugin {
200200
return false;
201201
}
202202

203-
this.createFolderLintModal(ctx.file.parent);
203+
that.createFolderLintModal(ctx.file.parent);
204204
},
205205
});
206206

@@ -229,7 +229,7 @@ export default class LinterPlugin extends Plugin {
229229
return false;
230230
}
231231

232-
void this.addFolderToIgnoreList(ctx.file.parent);
232+
void that.addFolderToIgnoreList(ctx.file.parent);
233233
},
234234
});
235235

@@ -241,7 +241,7 @@ export default class LinterPlugin extends Plugin {
241241
return that.isMarkdownFile(ctx.file) && !that.shouldIgnoreFile(ctx.file);
242242
}
243243

244-
void this.addFileToIgnoreList(ctx.file);
244+
void that.addFileToIgnoreList(ctx.file);
245245
},
246246
icon: iconInfo.ignoreFile.id,
247247
});

src/rules.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import {
66
Option,
77
BooleanOption,
88
} from './option';
9-
import {YAMLException} from 'js-yaml';
109
import {LinterError} from './linter-error';
1110
import {getTextInLanguage, LanguageStringKey} from './lang/helpers';
1211
import {ignoreListOfTypes, IgnoreType} from './utils/ignore-types';
1312
import {LinterSettings} from './settings-data';
1413
import {App} from 'obsidian';
14+
import {YAMLParseError} from 'yaml';
1515

1616
export type Options = { [optionName: string]: any};
1717

@@ -188,12 +188,13 @@ export function sortRules(): void {
188188

189189
export function wrapLintError(error: Error, ruleName: string) {
190190
let errorMessage: string;
191-
if (error instanceof YAMLException) {
191+
if (error instanceof YAMLParseError) {
192192
errorMessage = error.toString();
193193
errorMessage = getTextInLanguage('logs.wrapper-yaml-error').replace('{ERROR_MESSAGE}', errorMessage.substring(errorMessage.indexOf(':') + 1));
194194
} else {
195195
errorMessage = getTextInLanguage('logs.wrapper-unknown-error').replace('{ERROR_MESSAGE}', error.message);
196196
}
197197

198+
// TODO: clean this up, and see about replacing encountered an with the appropriate getTextInLanguage
198199
throw new LinterError(`"${ruleName}" encountered an ${errorMessage}`, error);
199200
}

src/utils/mdast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export function getPositions(type: MDAstTypes, text: string): Position[] {
117117
* @return {PositionPlusEmptyIndicator[]} The positions of the list item text in the given text
118118
* with a status as to whether or not they are empty
119119
*/
120-
function getListItemTextPositions(text: string, includeEmptyNodes: boolean = false): Position[] {
120+
function getListItemTextPositions(text: string, includeEmptyNodes: boolean = false): PositionPlusEmptyIndicator[] {
121121
const ast = parseTextToAST(text);
122122
const positions: PositionPlusEmptyIndicator[] = [];
123123
visit(ast, MDAstTypes.ListItem as string, (node) => {

0 commit comments

Comments
 (0)