Page 39 of 40

Re: Coder plugin (3)

Posted: Sat Dec 30, 2023 12:21 pm
by Cuprum
Задумал сделать подсветку Котлина. Из-за особенностей языка в коде возможны весьма сложные конструкции.
Более-менее удалось правильно подсветить такой однострочный пример

Code: Select all

val message = "$n is ${if (n > 0) "positive" else if (n < 0) "negative and ${if (n % 2 == 0) "even" else "odd"}" else "zero"}"
с помощью

Code: Select all

QuotesRE:
;================================================================================================================
;Flags  Pattern                              \BackRef=(FontStyle,ColorText,ColorBk) \BackRef=...  ParentID RuleID
;================================================================================================================
0	`".*"`                                "\0=(0,${STR},0)"                                        0    1
0	`\$\{.*\}`                            "\0=(0,0,0)"                                             1    2
0	`"[^"]*(?=\$\{)`                      "\0=(0,${STR},0)"                                        1    3
0	`"[^"]*"`                             "\0=(0,${STR},0)"                                        1    3
0	`(?<=\})[^"}]*"`                      "\0=(0,${STR},0)"                                        1    3
0	`"[^"}]*?(?=\$\{)`                    "\0=(0,${STR},0)"                                        2    3
0	`(?<=\})[^"}]*?"`                     "\0=(0,${STR},0)"                                        2    3
0	`"[^"}]*?"`                           "\0=(0,${STR},0)"                                        2    3
0	`(?<!\\)(\$)([A-Za-z_][A-Za-z_\d]*)`  "\1=(0,${OP},0) \2=(0,${HighLight_BasicTextColor},0)"   -2
0	`\$(?=\{)`                   "\0=(0,${OP},0)"                                                 -2
.


Image
.

Но ожидаемо из-за жадности поиска кавычек в первом правиле QuotesRE вот такая строка

Code: Select all

(e.message?.let { ": $it" } ?: ""))
сразу ломает

Image
.
Код выше еще можно раскрасить последовательно с помощью Quotes, но там тоже будут ложные срабатывания во многих других участках кода.
Есть у кого идеи как сделать такие случаи? А возможно ли вообще?

Re: Coder plugin (3)

Posted: Sat Aug 24, 2024 7:43 pm
by Diamen
Rarely crash, step:
Download and load this file in editor.
Down with cursor.
When arrive to row 50 crash.

Re: Coder plugin (3)

Posted: Thu Sep 19, 2024 6:49 am
by Diamen
Why CodeFold not work in json.coder?

Re: Coder plugin (3)

Posted: Sun Oct 06, 2024 5:05 pm
by Instructor
Diamen wrote: Sat Aug 24, 2024 7:43 pmRarely crash, step:
There is 14 lines in "jsonlint.html" file and no crash.

Re: Coder plugin (3)

Posted: Mon Oct 07, 2024 8:48 am
by ewild
Diamen wrote: Thu Sep 19, 2024 6:49 am Why CodeFold not work in json.coder?
Not confirmed. It works as intended.
Instructor wrote: Sun Oct 06, 2024 5:05 pm There is 14 lines in "jsonlint.html" file...
There are 56 lines in the file.
It's seen either just by viewing the page source online in the browser or the downloaded file:

Code: Select all

command:
wget --timestamping --no-hsts "https://interno.altervista.org/temp/jsonlint.html"
result:
jsonlint.html, 2024-08-24 22:37:48, 1538 b, md5: e141f932b258184501b32c58f4e4639c
Instructor wrote: Sun Oct 06, 2024 5:05 pm ... and no crash.
Can confirm that. No crash on jsonlint.html for AkelPad v.4.9.9 64-bit + Coder plugin v.20.4 64-bit.

Re: Coder plugin (3)

Posted: Mon Oct 07, 2024 4:06 pm
by Diamen
Diamen wrote: Sat Aug 24, 2024 7:43 pm Rarely crash, step:
Download and load this file in editor.
Down with cursor.
When arrive to row 50 crash.
It crash if I have in AkelPad.ini:
Coder::CodeFold=65536
LineBoard::Main=65536
but if I change font size with ctrl- not crash .

Why not work CodeFold for .json to me?

Re: Coder plugin (3)

Posted: Mon Oct 07, 2024 4:22 pm
by Instructor
Diamen wrote: Mon Oct 07, 2024 4:06 pmIt crash if I have in AkelPad.ini
Can you send to email or share your akelpad folder with problem HTML file?

Re: Coder plugin (3)

Posted: Mon Oct 07, 2024 6:27 pm
by Diamen
Diamen wrote: Sat Aug 24, 2024 7:43 pm Why not work CodeFold for .json to me?
excuse me, I confuse with XBrackets plugin.

Re: Coder plugin (3)

Posted: Mon Oct 07, 2024 6:34 pm
by Diamen
Instructor wrote: Mon Oct 07, 2024 4:22 pm
Diamen wrote: Mon Oct 07, 2024 4:06 pmIt crash if I have in AkelPad.ini
Can you send to email or share your akelpad folder with problem HTML file?
I changed zooms and I can't reproduce it anymore.

Re: Coder plugin (3)

Posted: Thu Nov 14, 2024 6:47 pm
by Infocatcher
У меня тут спрашивают про подсветку ссылок только при наведении:
https://github.com/Infocatcher/AkelPad_coder/issues/5
То есть чтобы текст ссылки выводился как обычный и подсвечивался только при наведении курсора.
Впрочем, я бы подчеркивание оставил (и сделал бы отдельной настройкой его отключение).

Re: Coder plugin (3)

Posted: Sun Nov 17, 2024 6:16 pm
by Instructor
Infocatcher
Подсветка ссылок приоритетнее чем Folds. Поэтому нельзя, чтобы ссылки зависили от Folds.

Re: Coder plugin (3)

Posted: Sun Nov 17, 2024 6:28 pm
by Infocatcher
Instructor
Так это в процессе поиска приоритет.
А можно найти, запомнить, но не красить, пока не отработает Coder, если тот установлен?

Re: Coder plugin (3)

Posted: Sun Nov 24, 2024 5:05 pm
by Instructor
Infocatcher
Сделать можно, но это смена приоритетов. Данная смена не планируется.

Re: Coder plugin (3)

Posted: Tue Feb 04, 2025 11:19 am
by newquaker
подскажите будьте добры возможно ли указать относительный путь в параметре HighLight_BkImageFile? я указал там файл 1.jpg положив рядом с exe, но он не отображается

Re: Coder plugin (3)

Posted: Tue Feb 04, 2025 12:07 pm
by yozhic
newquaker
Здесь действуют внутренние переменные AkelPad

Code: Select all

"%a\1.jpg"
В справке поиском по %a гляньте, все они перечислены.
Ещё пример:
Image

Fatal: Not able to open ./cache/production/data_global.php