Filters

Here you can discuss about your favorite plug-in.
User avatar
HaRT
Moderator
Posts: 9527
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 109 times
Been thanked: 228 times

Filters

Post by HaRT »

Latest post of the previous page:

pepak wrote: Thu 26 Sep, 2019 18:55 What is the source of Plugin Information's dialog data?
Presumably the Version field of the GlobalInfo structure filled in the GetGlobalInfoW function exposed by the plug-in. Formally, it's unrelated to Windows' VERSION_INFO, but ideally should represent the same version. Far Encyclopedia recommends using the MAKEFARVERSION macro to form the version value.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 474
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 12 times
Been thanked: 36 times

Filters

Post by pepak »

Yep, it's an error in all my plugins. Will fix it eventually to match the Windows version info.
User avatar
HaRT
Moderator
Posts: 9527
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 109 times
Been thanked: 228 times

Filters

Post by HaRT »

pepak, a bug surfaced: the “JSON format” filter does not show up in *.json files where the top-level element is not an object, mostly affecting JSON files with a top-level array. According to the grammar, object is not the only valid top-level element, and top-level arrays are of particular importance.
How to reproduce: create a file named e.g. json.json with 2 characters: [], invoke Filters.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 474
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 12 times
Been thanked: 36 times

Filters

Post by pepak »

That is a limitation of the component used, I think. It would be possible to fix by wrapping the array inside an object, but it seems the detection of this case is more complicated than simply creating the wrapper manually. Also, if it really is a major issue for someone, they can easily set up an external JSON formatter instead of the built-in one and that will take care of any similar issues immediately.
Last edited by pepak on Mon 07 Oct, 2019 16:22, edited 1 time in total.
User avatar
HaRT
Moderator
Posts: 9527
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 109 times
Been thanked: 228 times

Filters

Post by HaRT »

pepak wrote: Mon 07 Oct, 2019 16:21 That is a limitation of the component used, I think.
What's the component? Those I used myself just had a separate method to handle top-level arrays.
If it turns out to be a limitation indeed, please document this to save people like me from spending time trying to figure out why the plug-in does not work in their case.
Last edited by HaRT on Mon 07 Oct, 2019 16:31, edited 1 time in total.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 474
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 12 times
Been thanked: 36 times

Filters

Post by pepak »

HaRT wrote: Mon 07 Oct, 2019 16:28
pepak wrote: Mon 07 Oct, 2019 16:21 That is a limitation of the component used, I think.
What's the component? Those I used myself just had a separate method to handle top-level arrays.
Henri Gourvest's SuperObject.
If it turns out to be a limitation indeed, please document this to save people like me from spending time trying to figure out why the plug-in does not work in their case.
Frankly, it never occurred to me that this might be a problem in the component. Maybe it can even cope, somehow.
LAT
Posts: 325
Joined: Thu 21 Jan, 2010 20:00
Has thanked: 19 times
Been thanked: 34 times

Filters

Post by LAT »

Could you please advice an utility for formatting of the javascript-code, that can be used as external filter for this plugin?
pepak
Posts: 474
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 12 times
Been thanked: 36 times

Filters

Post by pepak »

I wish! Looking for one myself.
stefanenko
Posts: 126
Joined: Sun 20 Jun, 2010 12:37
Has thanked: 33 times
Been thanked: 4 times

Filters

Post by stefanenko »

XML is read as windows-2151 and encoded in utf-8. When pressed again, the conversion 1251-> utf-8 again occurs and all non-English text goes bad!
pepak
Posts: 474
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 12 times
Been thanked: 36 times

Filters

Post by pepak »

stefanenko wrote: Mon 28 Oct, 2019 07:11 XML is read as windows-2151 and encoded in utf-8. When pressed again, the conversion 1251-> utf-8 again occurs and all non-English text goes bad!
Nope. XML is read in the editor's encoding and written also in editor's encoding.
stefanenko
Posts: 126
Joined: Sun 20 Jun, 2010 12:37
Has thanked: 33 times
Been thanked: 4 times

Filters

Post by stefanenko »

Code: Select all

--- open file

C:\2Work\phpunit.xml                                 │  │1251 │
<?xml version="1.0" encoding="windows-1251"?>
<phpunit>
<env name="TEST" value="тестовая строка"/>
</phpunit>

--- after press F5

C:\2Work\phpunit.xml                                 │* │1251 │
<?xml version="1.0" encoding="windows-1251"?>
<phpunit>
  <env name="TEST" value="тестовая строка"/>
</phpunit>

--- after press Shift-F8 and select UTF-8

C:\2Work\phpunit.xml                                     │* │UTF-8│
<?xml version="1.0" encoding="windows-1251"?>
<phpunit>
  <env name="TEST" value="тестовая строка"/>
</phpunit>

--- again press F5

C:\2Work\phpunit.xml                                     │* │UTF-8│
<?xml version="1.0" encoding="windows-1251"?>
<phpunit>
  <env name="TEST" value="тестовая строка"/>
</phpunit>

--  done. the encoding is broken. (if save)
stefanenko
Posts: 126
Joined: Sun 20 Jun, 2010 12:37
Has thanked: 33 times
Been thanked: 4 times

Filters

Post by stefanenko »

OR open

Code: Select all

<?xml version="1.0" encoding="windows-1251"?>
<phpunit>
<env name="TEST" value="тестовая строка"/>
</phpunit>
and press F5 four times...

Code: Select all

<?xml version="1.0" encoding="windows-1251"?>
<phpunit>
  <env name="TEST" value="тестовая строка"/>
</phpunit>
stefanenko
Posts: 126
Joined: Sun 20 Jun, 2010 12:37
Has thanked: 33 times
Been thanked: 4 times

Filters

Post by stefanenko »

By the way, I like the plugin. I can do external formatting with my tools. Thanks
User avatar
HaRT
Moderator
Posts: 9527
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 109 times
Been thanked: 228 times

Filters

Post by HaRT »

stefanenko wrote: Mon 28 Oct, 2019 07:11 XML is read as windows-2151 and encoded in utf-8. When pressed again, the conversion 1251-> utf-8 again occurs and all non-English text goes bad!
I experience the same (mis-)behavior.
Фар есть инструмент, а не нянька. © 2009 DrKnS
stefanenko
Posts: 126
Joined: Sun 20 Jun, 2010 12:37
Has thanked: 33 times
Been thanked: 4 times

Filters

Post by stefanenko »

I wanted to be able to have several handlers with a choice

Code: Select all

Autoselect
HTML View using elinks                  *.htm,*.html,*.xhtml
XML Format                 *.xml,*.xsd,*.xslt,*.wsdl,*.xhtml
xmllint                                                *.xml
2nd tools                                              *.xml
JSON Format                                           *.json
pepak
Posts: 474
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 12 times
Been thanked: 36 times

Filters

Post by pepak »

Hmm. Seems like the encoding attribute is the problem. Once you remove it, everything is fine. I will have to remove it before the filter starts its work, I guess. Or something like that.
Post Reply

Return to “General Plug-In Discussions”