mirror of
https://github.com/kdnk/obsidian-automatic-linker.git
synced 2026-07-22 12:00:30 +00:00
chore: rename linterDelayMs to formatDelayMs
This commit is contained in:
parent
0fd620ecb6
commit
563dbe6ea8
3 changed files with 9 additions and 9 deletions
|
|
@ -396,11 +396,11 @@ export default class AutomaticLinkerPlugin extends Plugin {
|
|||
if (checking) {
|
||||
return saveCallback?.(checking);
|
||||
} else {
|
||||
await sleep(this.settings.linterDelayMs ?? 100);
|
||||
await sleep(this.settings.formatDelayMs ?? 100);
|
||||
await this.formatOnSave();
|
||||
|
||||
if (this.settings.runPrettierAfterFormatting) {
|
||||
await sleep(this.settings.linterDelayMs ?? 100);
|
||||
await sleep(this.settings.formatDelayMs ?? 100);
|
||||
//@ts-expect-error
|
||||
await this.app?.commands?.executeCommandById(
|
||||
"prettier-format:format-file",
|
||||
|
|
@ -409,7 +409,7 @@ export default class AutomaticLinkerPlugin extends Plugin {
|
|||
|
||||
// Run Obsidian Linter after formatting if enabled
|
||||
if (this.settings.runLinterAfterFormatting) {
|
||||
await sleep(this.settings.linterDelayMs ?? 100);
|
||||
await sleep(this.settings.formatDelayMs ?? 100);
|
||||
//@ts-expect-error
|
||||
await this.app?.commands?.executeCommandById(
|
||||
"obsidian-linter:lint-file",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export type AutomaticLinkerSettings = {
|
|||
removeAliasInDirs: string[]; // Remove aliases for links in specified directories
|
||||
runLinterAfterFormatting: boolean; // Run Obsidian Linter after automatic linker formatting
|
||||
runPrettierAfterFormatting: boolean; // Run Prettier after automatic linker formatting
|
||||
linterDelayMs: number; // Delay in milliseconds before running linter after formatting
|
||||
formatDelayMs: number; // Delay in milliseconds before running linter after formatting
|
||||
};
|
||||
|
||||
export const DEFAULT_SETTINGS: AutomaticLinkerSettings = {
|
||||
|
|
@ -45,5 +45,5 @@ export const DEFAULT_SETTINGS: AutomaticLinkerSettings = {
|
|||
removeAliasInDirs: [], // Default: no directories for alias removal
|
||||
runLinterAfterFormatting: false, // Default: do not run linter after formatting
|
||||
runPrettierAfterFormatting: false, // Run Prettier after automatic linker formatting
|
||||
linterDelayMs: 300, // Default: 300ms delay before running linter
|
||||
formatDelayMs: 1, // Default: 300ms delay before running linter
|
||||
};
|
||||
|
|
|
|||
|
|
@ -61,17 +61,17 @@ export class AutomaticLinkerPluginSettingsTab extends PluginSettingTab {
|
|||
|
||||
// Setting for linter delay
|
||||
new Setting(containerEl)
|
||||
.setName("Linter delay (ms)")
|
||||
.setName("Format delay (ms)")
|
||||
.setDesc(
|
||||
"Delay in milliseconds before running Obsidian Linter after formatting. Increase this value if the linter runs before the file is fully saved.",
|
||||
"Delay in milliseconds before formatting. Increase this value if the linter/prettier runs before the file is fully saved.",
|
||||
)
|
||||
.addText((text) => {
|
||||
text.setPlaceholder("e.g. 100")
|
||||
.setValue(this.plugin.settings.linterDelayMs.toString())
|
||||
.setValue(this.plugin.settings.formatDelayMs.toString())
|
||||
.onChange(async (value) => {
|
||||
const parsedValue = parseInt(value);
|
||||
if (!isNaN(parsedValue) && parsedValue >= 0) {
|
||||
this.plugin.settings.linterDelayMs = parsedValue;
|
||||
this.plugin.settings.formatDelayMs = parsedValue;
|
||||
await this.plugin.saveData(this.plugin.settings);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue