Colorer — syntax highlighting and text parsing

Here you can discuss about your favorite plug-in.
d3x0r
Posts: 6
Joined: Fri 01 Apr, 2011 21:27

ES6 Template Literal syntax highlighting

Post by d3x0r »

Latest post of the previous page:

ES6 Template Literal syntax highlighting
In the editor, Javascript template literals quoted with ` ` do not group the text as text; and instead open/close parens/braces in the string affect highlighting next entries.

https://developer.mozilla.org/en-US/doc ... e_literals

Would be nice if support was added for strings quoted with `...`.
Last edited by HaRT on Wed 14 Jun, 2017 13:32, edited 1 time in total.
Reason: Copied the ex-topic subject into the message
peter.mlich
Posts: 3
Joined: Thu 13 Dec, 2018 09:38

Colorer — syntax highlighting and text parsing

Post by peter.mlich »

Version 1.2.1.2 . 20.06.2013
Bug bad color:

php code:

Code: Select all

//	$form['mail']['to']   = 'my.mail snail server dot cz';	// comment
(not colored full line as comment)

js code:

Code: Select all

	// comment
(not colored full line as comment)

Code: Select all

// comment
(but this works correct)

And other bugs, or try check, example:
- on long <img> tag with long base64 src not end color syntax src="..." - still opened " on new line
- js code reg. expression syntax str=str.replace(/aaa/g,'xxx') or str=str.replace(new regExp('aaa','g'), 'xxx')
- js code multi-line syntax

Code: Select all

x = 'aaa\
bbb\
';
peter.mlich
Posts: 3
Joined: Thu 13 Dec, 2018 09:38

Colorer — syntax highlighting and text parsing

Post by peter.mlich »

https://plugring.farmanager.com/plugin.php?pid=526&l=en
Wow, on main page i found older version plugin than my 1.2.1.2
LigH
Posts: 61
Joined: Fri 19 Mar, 2010 14:12
Has thanked: 2 times
Been thanked: 1 time

Colorer — syntax highlighting and text parsing

Post by LigH »

The current repository is at:

https://github.com/colorer/FarColorer

Download binary releases from:

https://github.com/colorer/FarColorer/releases

Furthermore, a rather recent installation of Far Manager v3.0.5xxx should contain a just as recent FarColorer plugin.
Last edited by LigH on Thu 13 Dec, 2018 10:12, edited 2 times in total.
csaba.coder
Posts: 1
Joined: Tue 21 May, 2019 10:18

Colorer — syntax highlighting and text parsing

Post by csaba.coder »

I found a little error in the SQL.hrc file.
In SQL file the string content separator character apostrophe. ('some string'). If I use apostrophe as part of string content, I use double apostrophe ('string with '' character', therefore the escape charetrer is an other apostrophe). But the sql.hrc use as escape the backslash (\) character instead of apostrophe). Would be nice if support fix this error.

A possible fix:

sql.hrc from line 949 current:

<scheme name="stringApost" if="backslash_escapes">
<regexp match="/\\'/" region='def:StringContent'/>
</scheme>

With my fix:

<scheme name="stringApost" if="backslash_escapes">
<regexp match="/''/" region='def:StringContent'/>
</scheme>

This may not be the best, but working.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Colorer — syntax highlighting and text parsing

Post by pepak »

Is it possible to disable Colorer for one specific instance of the editor? Suppose that I open a file that causes trouble to Colorer - by being too large or by matching a condition that Colorer assigns to a different type of file. It would be more useful to disable Colorer for this file and get a plain non-colored output than have slow operations or incorrect colors. I could disable Colorer completely, but that would affect all the other editors, too.
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

Colorer — syntax highlighting and text parsing

Post by HaRT »

pepak wrote: Fri 24 Jul, 2020 07:00 disable Colorer for this file and get a plain non-colored output
You can invoke the plug-in's menu, select “List types” and choose “default type” (use menu filtering) — it will not literally disable Colorer but will make it least intrusive (unnoticeable indeed) while preserving such nice features as cross.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Colorer — syntax highlighting and text parsing

Post by pepak »

Nice, thanks!
S.A.
Posts: 61
Joined: Mon 17 Nov, 2014 19:52
Been thanked: 7 times

Colorer — syntax highlighting and text parsing

Post by S.A. »

pepak,
I usually enable and disable the plugin on the fly using a macros. It will affect other instances of the editor, of course, but I guess it's not much of a problem if there's only a single keypress involved.
The only caveat is that as of the latest nightly build available (5645.1676), running the macros will crash Far, as there was a bug in Colorer that has already been fixed. If you're using nightly builds, wait for the next build if this approach seems worth trying.

Code: Select all

Macro {
  area="Editor"; key="F1"; flags=""; description="toggle colorer"; action = function()
if Plugin.Call("D2F36B62-A470-418D-83A3-ED7A3710E5B5","status")==false
then
Plugin.Call("D2F36B62-A470-418D-83A3-ED7A3710E5B5","Settings","Status",1)
elseif Plugin.Call("D2F36B62-A470-418D-83A3-ED7A3710E5B5","status")==true
then
Plugin.Call("D2F36B62-A470-418D-83A3-ED7A3710E5B5","Settings","Status",0)
end
  end;
}
Last edited by S.A. on Tue 28 Jul, 2020 20:53, edited 1 time in total.
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Colorer — syntax highlighting and text parsing

Post by Shmuel »

S.A., here's your macro after refactoring it a bit:

Code: Select all

Macro {
  description="toggle colorer"; area="Editor"; key="F1";
  action=function()
    local guid="D2F36B62-A470-418D-83A3-ED7A3710E5B5"
    Plugin.Call(guid,"Settings","Status",Plugin.Call(guid,"Settings","Status") and 0 or 1)
  end;
}
S.A.
Posts: 61
Joined: Mon 17 Nov, 2014 19:52
Been thanked: 7 times

Colorer — syntax highlighting and text parsing

Post by S.A. »

Shmuel wrote: Tue 28 Jul, 2020 21:05 here's your macro after refactoring it a bit:
It's way more elegant and presentable, no doubting that :)
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Colorer — syntax highlighting and text parsing

Post by pepak »

Thanks! I would still prefer to get a solution for one specific editor only. Perhaps it's time to look into how to build FAR plugins, too, since I am already building my FAR...
S.A.
Posts: 61
Joined: Mon 17 Nov, 2014 19:52
Been thanked: 7 times

Colorer — syntax highlighting and text parsing

Post by S.A. »

I've since tried to go the "default type" way offered by HaRT, but I use a grayscale color scheme, and I don't want to mess with any of the Colorer's default settings.
Last edited by S.A. on Thu 30 Jul, 2020 13:10, edited 1 time in total.
User avatar
ctapmex
Posts: 1240
Joined: Fri 11 Apr, 2008 07:53
Has thanked: 1 time
Been thanked: 50 times

Colorer — syntax highlighting and text parsing

Post by ctapmex »

pepak,
check this on colorer 1.3.20

Code: Select all

Macro {
  description="toggle colorer"; area="Editor"; key="F1";
  action=function()
    local guid="D2F36B62-A470-418D-83A3-ED7A3710E5B5"
    Plugin.Call(guid,"Editor","Status",Plugin.Call(guid,"Editor","Status") and 0 or 1)
  end;
}
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Colorer — syntax highlighting and text parsing

Post by pepak »

I couldn't try it just yet, but looking at the commit, it seems to be exactly what I wanted! Thank you so much!
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Colorer — syntax highlighting and text parsing

Post by pepak »

Works perfectly. Thanks a lot!
Post Reply

Return to “General Plug-In Discussions”