-
Notifications
You must be signed in to change notification settings - Fork 112
fix: consider checking params in checkCallback
#1324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
687a1c0
029de94
5546682
ca33bf1
ce72500
64d00ab
25863f0
4f6c735
21065d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,7 @@ | |
| private overridePaste: boolean = false; | ||
| private hasCustomCommands: boolean = false; | ||
| private customCommandsLock = new AsyncLock(); | ||
| private originalSaveCallback?: () => void = null; | ||
| private originalSaveCallback?: (checking: boolean) => boolean | void = null; | ||
| // The amount of files you can use editor lint on at once is pretty small, so we will use an array | ||
| private editorLintFiles: TFile[] = []; | ||
| // the amount of files that can be linted as a file can be quite large, so we will want to use a set to make | ||
|
|
@@ -322,15 +322,18 @@ | |
| this.originalSaveCallback = saveCommandDefinition?.checkCallback; | ||
|
|
||
| if (typeof this.originalSaveCallback === 'function') { | ||
| saveCommandDefinition.checkCallback = () => { | ||
| this.originalSaveCallback(); | ||
| saveCommandDefinition.checkCallback = (checking: boolean) => { | ||
| this.originalSaveCallback(checking); | ||
|
|
||
| if (this.settings.lintOnSave && this.isEnabled) { | ||
| const editor = this.getEditor(); | ||
| if (editor) { | ||
| const file = this.app.workspace.getActiveFile(); | ||
| if (!this.shouldIgnoreFile(file) && this.isMarkdownFile(file) && editor.cm) { | ||
| void this.runLinterEditor(editor); | ||
| if (!checking) { | ||
| this.runLinterEditor(editor); | ||
| } | ||
| return true; | ||
|
||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.