The only way I got to make a python.hightlight be loaded and work was downloading source code, isolating gb.highlight files, adding the new python.hightlight, recompiling, making the executable and puting it in usr/lib/gambas3
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"
Only compiling gb.highlight with the new hightlight?
-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Only compiling gb.highlight with the new hightlight?
Last edited by sergioabreu on Thu Aug 01, 2024 4:02 pm, edited 1 time in total.
- BruceSteers
- Legend
- Posts: 2159
- Joined: Thu Jul 23, 2020 5:20 pm
- Location: Isle of Wight
Re: Only compiling gb.highlight with the new hightlight?
wiki shows this....
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?
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?
-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: Only compiling gb.highlight with the new hightlight?
Found the syntax to load highlighter
Now texteditor do not accept the new key as highlight.
Now texteditor do not accept the new key as highlight.
Code: Select all
myTextEditor.highlight = "javascript" ' = ok
myTextEditor.highlight = "php" ' or python, that I just loaded = error
Last edited by sergioabreu on Thu Aug 01, 2024 6:00 pm, edited 2 times in total.
-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: Only compiling gb.highlight with the new hightlight?
I Got to Load at least. I am doing also php highlight.
The syntax accepted is:
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:
It throws an error saying can't load php highlighter.
Maybe I am missing some step.
The syntax accepted is:
Code: Select all
TextHighlighter.Register("php", "php", "highlight/php.highlight")
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: Select all
myTextEditor.highlight = "php" 'that I loaded above
Maybe I am missing some step.
- BruceSteers
- Legend
- Posts: 2159
- Joined: Thu Jul 23, 2020 5:20 pm
- Location: Isle of Wight
Re: Only compiling gb.highlight with the new hightlight?
My guess is the highlight file you are using is an incomplete modified copy of another one.
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.
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.
- BruceSteers
- Legend
- Posts: 2159
- Joined: Thu Jul 23, 2020 5:20 pm
- Location: Isle of Wight
Re: Only compiling gb.highlight with the new hightlight?
I looked at the source and realised the path is not needed, as you say it should be handled.
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.
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.
-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: Only compiling gb.highlight with the new hightlight?
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.
Now everything is working fine.
PS: I have converted the code to use Theme as you suggested. Thanks
Custom folder with:
* CustomHighlighter.class
* .project template
These files are needed to compile the "on the fly" new class.
Now everything is working fine.
PS: I have converted the code to use Theme as you suggested. Thanks

-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: The Keys of Theme could be case insensitive?
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.
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.
- BruceSteers
- Legend
- Posts: 2159
- Joined: Thu Jul 23, 2020 5:20 pm
- Location: Isle of Wight
Re: Only compiling gb.highlight with the new hightlight?
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.sergioabreu wrote: ↑Fri Aug 02, 2024 1:45 am 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.
Now everything is working fine.
PS: I have converted the code to use Theme as you suggested. Thanks![]()
glad you found a way though
- BruceSteers
- Legend
- Posts: 2159
- Joined: Thu Jul 23, 2020 5:20 pm
- Location: Isle of Wight
Re: The Keys of Theme could be case insensitive?
Generally Key names are case sensitive. changing the way gambas works could possibly break peoples existing software,sergioabreu wrote: ↑Fri Aug 02, 2024 2:05 am 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.
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.