Page 1 of 1
Sublime 3 - Python3 - linux :)
Posted: Mon Sep 03, 2018 11:02 pm
by vwidmer
I am not the original author of this I only tried to fix the original from:
Code: Select all
https://www.purebasic.fr/english/viewtopic.php?f=7&t=49273&hilit=sublime&sid=b9075562ea241772e64f71c2249197b2
I made some slight changes to make it work on Sublime 3, and with Python3 and on Linux
Doubt it will work on Windows or OSX.
Anyways here it is:
https://sync.usingssl.com/index.php/s/kcNgbJEf4mYYkdd
You will probably need to edit the file "PureBasic.sublime-build" and correct the paths to your installation.
I dont use the "pbcompiler" much so I dont know all the switches.
Can view what I left / added / removed the "Sublime -> Tools -> PureBasic - Compiler Options" menu.
If you change something or want something added let me know and I can try.
Also I am very new to python so I tried what I could to fix the "PureBasic.py" and it seems to be working but if some one has more skill/knowledge then me then please check it.
Have fun.
Re: Sublime 3 - Python3 - linux :)
Posted: Tue Sep 04, 2018 5:13 pm
by Justin
That's great, thanks.
I did a quick test and found a little issue, if you have a folder with the same name of the file you try to compile in the same location it fails.
Is it possible to have a function listing to jump to a function?
Re: Sublime 3 - Python3 - linux :)
Posted: Tue Sep 04, 2018 5:30 pm
by vwidmer
Justin wrote:That's great, thanks.
I did a quick test and found a little issue, if you have a folder with the same name of the file you try to compile in the same location it fails.
Is it possible to have a function listing to jump to a function?
do you mean can have the file and folder in same directory? or do you mean when the file to compile is in a folder that has the same name?
Also can you please give me an example of what u mean by jump to function? I dont understand fully.
Thanks
Re: Sublime 3 - Python3 - linux :)
Posted: Tue Sep 04, 2018 6:17 pm
by Justin
I can't test the folder thing now, i will check later.
The function listing is like the procedure browser in the PB IDE, a listbox that displays the available procedures on the current file and when you click on one the editor jumps to the procedure declaration.
I think ST has something like a go to symbol option that displays the available methods/structures o whatever and you can jump to the declaration.
Re: Sublime 3 - Python3 - linux :)
Posted: Tue Sep 04, 2018 7:31 pm
by vwidmer
Re: Sublime 3 - Python3 - linux :)
Posted: Tue Sep 04, 2018 9:02 pm
by Justin
Yes something like that, it's pretty good now, although it does not update live, you have to close it and open again to reflect the changes, is there a shortcut to refresh?
Also it would be nice if scanned for structures and interfaces and maybe the ';- ' marker like in the PB IDE.
Can the structures and interface autocomplete be implemented? Like when you type a structure and pops up the structure fields.
Forget the folder issue it was a problem of mine.
Another thing i have noticed is that the debug statements only appear in the console after the program exits, not during execution, this can be a problem. Maybe using to separate steps build / run would solve it?
For example:
Code: Select all
debug "open"
OpenWindow(0, 0, 0, 600, 300, "foo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
debug "opened"
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
debug "exit"
Debugs only show when you exit.
Re: Sublime 3 - Python3 - linux :)
Posted: Wed Sep 05, 2018 12:17 am
by vwidmer
Try updating the "PureBasic.sublime-build"
to look like this particularly line 2 just make sure you fix your PB location
Code: Select all
{
"cmd": ["stdbuf","-oL","/opt/purebasic/compilers/pbcompiler", "$file"],
"path": "/opt/purebasic/compilers:$PATH",
"file_regex": "\\s'?(.:.+\\.pb)'?",
"line_regex": "[ ]*Line ([0-9]*)",
"target": "buildpb",
"selector": "source.purebasic=",
"env":
{
"PUREBASIC_HOME": "/opt/purebasic"
}
}
That should show the debug stuff.
Re: Sublime 3 - Python3 - linux :)
Posted: Wed Sep 05, 2018 9:05 pm
by Justin
Hi vwidmer, it's strange the first time i tried it it worked, then it does not work any more, when building, the status bar shows Building for a few seconds and nothing happens. removing "stdbuf","-oL", builds as before.
Re: Sublime 3 - Python3 - linux :)
Posted: Wed Sep 05, 2018 9:08 pm
by vwidmer
maybe try just running something like
in a terminal and see if there is some issue.
or maybe try replacing stdbuf with the full path? Mine is "/usr/bin/stdbuf"
can find it via
Re: Sublime 3 - Python3 - linux :)
Posted: Thu Sep 06, 2018 10:02 pm
by Justin
The date works well.
The editor same as before, the first time build works showing the debugs well, and then it does not work anymore.
I have noticed that the language plugin format is very similar to the visual studio code one, maybe it would be easy for you to port it? It is free and really good.