mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
better stepping into other scripts, with source indicator
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { substituteParams } from '../../script.js';
|
||||
import { delay, escapeRegex } from '../utils.js';
|
||||
import { delay, escapeRegex, uuidv4 } from '../utils.js';
|
||||
import { SlashCommand } from './SlashCommand.js';
|
||||
import { SlashCommandAbortController } from './SlashCommandAbortController.js';
|
||||
import { SlashCommandBreak } from './SlashCommandBreak.js';
|
||||
@ -27,6 +27,14 @@ export class SlashCommandClosure {
|
||||
/**@type {string}*/ rawText;
|
||||
/**@type {string}*/ fullText;
|
||||
/**@type {string}*/ parserContext;
|
||||
/**@type {string}*/ #source = uuidv4();
|
||||
get source() { return this.#source; }
|
||||
set source(value) {
|
||||
this.#source = value;
|
||||
for (const executor of this.executorList) {
|
||||
executor.source = value;
|
||||
}
|
||||
}
|
||||
|
||||
/**@type {number}*/
|
||||
get commandCount() {
|
||||
@ -114,6 +122,7 @@ export class SlashCommandClosure {
|
||||
closure.rawText = this.rawText;
|
||||
closure.fullText = this.fullText;
|
||||
closure.parserContext = this.parserContext;
|
||||
closure.source = this.source;
|
||||
closure.onProgress = this.onProgress;
|
||||
return closure;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { uuidv4 } from '../utils.js';
|
||||
import { SlashCommand } from './SlashCommand.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
@ -16,6 +17,17 @@ export class SlashCommandExecutor {
|
||||
/**@type {Number}*/ startUnnamedArgs;
|
||||
/**@type {Number}*/ endUnnamedArgs;
|
||||
/**@type {String}*/ name = '';
|
||||
/**@type {String}*/ #source = uuidv4();
|
||||
get source() { return this.#source; }
|
||||
set source(value) {
|
||||
this.#source = value;
|
||||
for (const arg of this.namedArgumentList.filter(it=>it.value instanceof SlashCommandClosure)) {
|
||||
arg.value.source = value;
|
||||
}
|
||||
for (const arg of this.unnamedArgumentList.filter(it=>it.value instanceof SlashCommandClosure)) {
|
||||
arg.value.source = value;
|
||||
}
|
||||
}
|
||||
/**@type {SlashCommand}*/ command;
|
||||
// @ts-ignore
|
||||
/**@type {SlashCommandNamedArgumentAssignment[]}*/ namedArgumentList = [];
|
||||
|
Reference in New Issue
Block a user