Skip to content

Commit 0dc10e8

Browse files
committed
improve comment
1 parent 23ac435 commit 0dc10e8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web_src/js/features/comp/TextExpander.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function initTextExpander(expander: TextExpanderElement) {
5151

5252
const textarea = expander.querySelector<HTMLTextAreaElement>('textarea');
5353

54+
// help to fix the text-expander "multiword+promise" bug: do not show the popup when there is no "#" before current line
5455
const shouldShowIssueSuggestions = () => {
5556
const posVal = textarea.value.substring(0, textarea.selectionStart);
5657
const lineStart = posVal.lastIndexOf('\n');
@@ -59,8 +60,8 @@ export function initTextExpander(expander: TextExpanderElement) {
5960
};
6061

6162
const debouncedIssueSuggestions = debounce(async (key: string, text: string): Promise<TextExpanderProvideResult> => {
62-
// Upstream bug: when using "multiword", TextExpander will get wrong "key" position.
63-
// To reproduce, use the "await sleep" below,
63+
// Upstream bug: when using "multiword+promise", TextExpander will get wrong "key" position.
64+
// To reproduce, comment out the "shouldShowIssueSuggestions" check, use the "await sleep" below,
6465
// then use content "close #20\nclose #20\close #20", keep changing the last line `#20` part from the end (including removing the `#`)
6566
// There will be a JS error: Uncaught (in promise) IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 28 is larger than the node's length (27).
6667
if (!shouldShowIssueSuggestions()) return {matched: false};

0 commit comments

Comments
 (0)