Only compiling gb.highlight with the new hightlight?
Posted
#1
(In Topic #1306)
Regular

Am I missing some more user friendly way to do it? Because when I tried to add a hightlight folder in the project with the python.highlight, the file was not loaded automatically. If I called TextHighLighter.register("python", "python") with a hightlight folder in the project containg the file, it raised "Out of Memory"
Posted
Guru

Static Sub Register ( Key As String [ , Name As String, Path As String ] )
does it work if you use the path part to your custom definition file in your highlight folder?
Posted
Regular

Now texteditor do not accept the new key as highlight.
Code
myTextEditor.highlight = "javascript" ' = ok
myTextEditor.highlight = "php" ' or python, that I just loaded = error
Posted
Regular

The syntax accepted is:
Code
TextHighlighter.Register("php", "php", "highlight/php.highlight")I dumped the TextHighLighter.List and php and python are there.
python that was compiled in gh.highlight, and works.
php that is loaded from project, enters to the TextHighLighter List, but when I try to attribute php to TextEditor.HighLight it it invokes CreateCustomHighLighter and get a file not found.
So, when I use in the code:
Code
myTextEditor.highlight = "php" 'that I loaded aboveIt throws an error saying can't load php highlighter.
Maybe I am missing some step.
Posted
Guru

some lines may contain @include statements that are for using other files the highlighter needs.
If i copy the sh.highlight file into my project and try to load it i get a "file not found" error.
It is because i lack the _number.regexp file.
I can either remove the 1st line from the highlighter if i'm not going to use it
@include _number.regexp
Or I can also add the _number.regexp file to my highlight folder.
if you have just copied the javascript.highlight file and none of it's "include" files then that's probably your problem.
Posted
Guru

It automatically tries looking for a highlight/KeyName.highlight file so just giving a php key name for the highlight/php.highlight file should work.
TextHighlighter.Register("php") should load a php.highlight file in a highlight folder.
So a "cannot load file" error is from within the highlight file itself.
That's probably a bug Benoit may fix. Or give a better error message.
Posted
Regular

Custom folder with:
* CustomHighlighter.class
* .project template
These files are needed to compile the "on the fly" new class.
<COLOR color="#0000FF">Now everything is working fine</COLOR>.
PS: I have converted the code to use Theme as you suggested. Thanks
Posted
Regular

I informed "symbol" as a Key and it raised me an Error of null object.
It would be nice if Theme["Symbol"] and Theme["symbol"] both worked.
Posted
Guru

sergioabreu said
The error was that apart from highlight folder and the correct path informed, it requires a custom folder to work too.
Custom folder with:
* CustomHighlighter.class
* .project template
These files are needed to compile the "on the fly" new class.
<COLOR color="#0000FF">Now everything is working fine</COLOR>.
PS: I have converted the code to use Theme as you suggested. Thanks
That's odd, I just made a highlight folder and put the sh.highlight file in there (I renamed to shh) everything worked as expected.
glad you found a way though
Posted
Guru

sergioabreu said
If the key for Theme were case insensitive would cause some problem ?
I informed "symbol" as a Key and it raised me an Error of null object.
It would be nice if Theme["Symbol"] and Theme["symbol"] both worked.
Generally Key names are case sensitive. changing the way gambas works could possibly break peoples existing software,
you must accept how it is. Don't be lazy and inaccurate with your code.
Not many like ideas of changing how gambas works as it could break existing software, so we use it as it is, If we want something different we can do it ourselves in our own software but the main gambas stays how it's designed, the only code breaking changes that ever happen are bug fixes.
If that's what you are asking for, you want something to work different for you in gambas. or you just moaning about your "bad case scenario", as it were.
We are here to help you learn some gambas,
We are not gambas developers. for that you want the gambas developers mailing list not this help forum.
Posted
Regular

In other words Theme(Upper(<whatevercasethekeywordmaybe>)) will always resolve … as long as your theme uses uppercase keys.
hth
t'other B
Posted
Regular

Because I have seen some keys insensitive in gambas:
Code
key["t"] = 84
key["T"] = 84
The above post shows how the developer team would do this.
I would do this inside some class (a private translation function):
Code
Private Function getHighLighterThemeStyle( insens as String, theme as TextHighLighterTheme ) as TextHighLigherThemeStyle
SELECT CASE Upper(insens)
case "LABEL"
return theme["Label"]
case "ID"
return theme["Id"]
case "SYMBOL"
return theme["Symbol"]
END SELECT
End
Posted
Guru

String.UcaseFirst might be a better way
Ps use gb instead of code to insert gambas code into your posts as it formats it better
Code
[code numbers="1" param="gambas" scroll="1"]
' insert gambas code here
[/code]
1 guest and 0 members have just viewed this.


