Hi guys, i want to share something with you. It is possible to have smart intelligence autocomplete in a new kind of Editor called Sublime Text 2.
I’m using SublimeText 2 with a couple packages installed. It is actually working!! . SublimeText is absolutely amazing! (no i’m not affiliated with the makers) See steps below the images…
[size=134]Steps to complete[/size]
- Download SublimeText 2
- Install the package manager
- Startup sublime text
- open package control (under preferences menu)
- Type “install” and press enter
- Now type a package name and press enter (repeat steps 4,5 and 6 this for every package)
- Quick File Creator
Now everything is installed you will need to configure your project.
- Open a folder for your project (File > open folder) (usualy …/MyProject/src)
- Save your project (Project > Save Project As…) in the …/MyProject folder and edit it: (Project > Edit Project). (folders are set relative from MyProject folder as where i saved my project file here) Edit the file like this and save it.
- Now we add Panda3D to the project. Rightclick on the folder name you just added to the project and click “Open Terminal here”
- In the terminal enter “cd …/”
- Add a directory called “.codeintel” (mkdir “.codeintel”)
- Cd in this directory and add a file called “config” (echo > config) and close the terminal
- Now open that file (you are almost done!)
- Paste this and adjust to your needs
// "python": "/usr/bin/python",
Don’t forget to save this idiot !
- YOU ARE DONE!
ST2 is great! Been using if for a while now for other projects and was having thoughts on creating some kind of Panda3D plugin. But it seems that will not be neccessary
Install the shaderLanguages plugin via Package Control and you benefit from syntax highlighting in glsl files. If you want it to apply to .sha files to, just add sha to the fileTypes array in “OpenGL SL.tmLanguage”. That file is found inside the ShaderLanguages plugin directory.
C:\Users\<USERNAME>\AppData\Roaming\Sublime Text 2\Packages\ShaderLanguages\OpenGL SL.tmLanguage
Still working on CityMania eh?
i use st2 as well. its great!
Hah, just waited for that one Yeah kinda !
i am on ubuntu… i’ve tried to follow your steps but code completition is not changed at all, some advice?
Trying to make this work.
It seems it doesn’t matter what I type to “config” file. The example you provided will work just fine without it (OnscreenImage example) but not with self.ground=self.loader.loadModel("model1)and then trying to autocomplete self.ground.??
Now when I clear data from “config” it does not matter at all.
My directory structure is:
main.py (under scr – only file here)
Is this correct?
How does it know to use panda if config file is empty?
How do I know that for example that main.py is included to project? Do I have to manually “Edit project” and add files? How does sublime know that it’s supposed to read .codeintel?
Btw is this supposed to work with 1.6.2?
That’s normal, because in Python a method can return virtually anything. That said it’s not possible what object self.ground is until the code is executed and at that spot.
You can only do code completion for classes or objects that obviously are of a certain type - and even that is not really reliable, because in Python everything is so dynamic (you can even change the methods of a class or of an object from outside).
By the way, you don’t need to set up a project, configure anything or even install the add ons from the post above. The code completion works out of the box with only SublimeCodeIntel add on installed. At least that works for me on Linux (where you don’t have to worry about python paths anyway ).
Still thanks for the tip with the SublimeCodeIntel add on
Thank you for telling me, this saves me many hours.
I think it might work in Windows too without anything added to config, but if one wants to do that the structure above is correct. Also if you make changes to config, only way I could be sure (Windows) that it builds the index is 1. Remove CodeIntel 2. Close Sublime 3. Instal CodeIntel 4. Close Sublime
It still remains mystery to me how to choose what python interpreter is in use and how Sublime includes Panda3D files automatically
Wow! Thanks for pointing out this wonderful little text editor. The codeIntel is very neat.
I did a little bit of researching and found that out that the Komodo IDE whose codeIntel Sublime is based upon, has an even richer codeIntel feature set: It can even provide calltips! Unfortunately, it’s also $250 dollars more.
Is there a separate thread for support questions?
If you’re referring to help with Panda3D in conjunction with Sublime Text 2 then ask here. For other Panda3D questions please search the forums for it as it might already got answered - if not, feel free to open a new thread.
I was wondering if I could have some help with autocomplete. I have followed the tutorial as best I can. The auto compete works but only with items in document and dose not display all options in the scope of the module.
Thanks in advance
you cant achieve good autocompletion because some of things just cant be resolved from static files. best option is using pydev autocompletion from here.