Sublime Forum

CodeIntel ported from Open Komodo Editor

#15

@paulstraw, Can you please pull the latest and try again please. Post the full log somewhere and the configuration file(s) if it’s still failing.

0 Likes

#16

Hi @Kronuz,

It built everything great !

After building the libs, i did this:

cd SublimeCodeIntel
cp -R libs python_codeintel.py ~/.config/sublime-text-2/Packages/User

Then i cannot start sublime-text anymore, giving me this error:

$ sublime-text 
Fatal Python error: Interpreter not initialized (version mismatch?)

Do you a hint on how to debug this ?

Thanks a lot for all effort !

0 Likes

#17

@dsarch, unfortunately no… I have no idea what the problem might be :frowning: …perhaps Sublime in linux ships with it’s own python binary and libraries? (most likely) being that the case, you’d have to compile everything again against the same version shipped within Sublime. Though I’m not sure it ships with the header files and development libraries.

Maybe @jps can give us some direction in this regard if he sees this thread… Jon, are you around? :smiley:

0 Likes

#18

[quote=“Kronuz”]Everyone, I just added the binaries to support Linux (32 and 64 bits) and Windows (32 bits only) …still really untested, we need people testing those platforms, anyone plz?
[/quote]

Thanks for your work.
Is it possible to have a 64 bits Windows build ? I haven’t any C compiler on my PC so not any chance to build it myself.
SilverCity is available from http://www.lfd.uci.edu/~gohlke/pythonlibs/ but not elementtree.
It’s probably possible to use the xml.etree package that come with the Python 2.6 from ST2 but it take some work to change all the call to cielementtree.

Someone could help us poor Windows 7 64 bits users ? Thanks.

0 Likes

#19

@bizoo, unfortunately, no… they’re both patched version (SilverCity and cElementTree)… so any binaries you find won’t work :frowning:
it should be pretty easy to build, however I don’t have a windows box to do the build at the moment. Maybe someone else is willing and able to make those binaries available.

0 Likes

#20

I really love this plugin. Unfortunately it has some problems to get my javascript namespaces (dojo style) right. This wouldn’t be an issue if it wouldn’t auto insert them. Maybe the new feature from build 2066 could help here?
“The auto_complete command now takes an optional disable_auto_insert argument”

0 Likes

#21

+1 for that x64 Windows version if anyone can manage it? I’d be happy to test. :smiley:

0 Likes

#22

@senzo, I believe SublimeCodeIntel is exactly the reason disable_auto_insert sprung to life. Pull my latest from github, it’s already using it :wink: …Linux binaries should be easy to build now too, I think :smile: … and Windows binaries should also be built …but I don’t have a way of building them (the provided 32 bits binaries are patchy).

0 Likes

#23

Okay, thanks to Jon, we now have linux (32 and 64 bits) binaries for SublimeCodeIntel!

Pull the latest from my github (sublimetext.com/dev.

Windows version has 32 bits binaries included …but they are patchy and might or might not consistently work as expected. Maybe someone can compile 32 or 64 bits Windows binaries? anyone? :smiley:

0 Likes

#24

Okay, thanks to Jon again we are all set for further testing! Windows (32 and 64 bits) binaries are in now! …so SublimeCodeIntel should work in all three platforms (Windows, Linux and Mac OS X).

I’m tagging SublimeCodeIntel v1.0b. Users wanted for testing!! :smiley:

github.com/Kronuz/SublimeCodeIntel

0 Likes

#25

Hey Kronuz,

This looks like a fantastic package, but… I can’t make it work on Windows.

What I’ve done:

  1. Installed the packages as per your instructions
  2. Created a new folder
  3. Created a new file one.py
  4. Typed in some Python functions.
  5. Pressed super+j

The status bar reports that CodeIntel is creating the indexes, but it does so every time I press the shortcut and nothing else happens.

0 Likes

#26

@guillermooo, What windows version are you using? 64 or 32 bits? try writing “import[space]” that should show you the list of available modules. Python I don’t think currently has direct autocomplete for function names (php does though).

You can also open a file with imports and try super+click (or super+f3, depends on your bindings) …to jump to the symbol definition.

0 Likes

#27

Working for me. Now if I type import[space] a dropdown appears listing the module and directories. In an HTML file, I can type <div[space] and a dropdown appears offering class= and id= options.

Really cool and surprisingly fast once the index is built.

Is it possible customise the attributes?

0 Likes

#28

I must be doing something silly, but it won’t work and it keeps indexing all the time.

I’m on Windows 7 Ultimate 64 bit.

Where is the index stored?

0 Likes

#29

@guillermooo, I have somewhat improved the loggings and fixed a couple issues. Could you please pull the latest and try again?

The indexes are saved at ~/.codeintel/db/ and there’s a log file at ~/.codeintel/codeintel.log (that gets wiped out and recreated every time you start Sublime Text).

0 Likes

#30

Seems broken to me:

startup, version: 2068 osx x32 channel: dev
executable: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
working dir: /
packages path: /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages
settings path: /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Settings
error parsing session: No data at: 0:0
PackageSetup not required
catalogue loaded
found 3 files for base name Default (OSX).sublime-keymap
found 1 files for base name Default (OSX).sublime-mousemap
found 1 files for base name Main.sublime-menu
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/comment.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/copy_path.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/delete_word.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/detect_indentation.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/duplicate_line.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/echo.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/exec.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/find_under_expand.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/font.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/goto_line.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/indentation.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/kill_ring.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/mark.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/new_templates.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/paragraph.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/save_on_focus_lost.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/scroll.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/side_bar.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/sort.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/swap_line.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/switch_file.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/transform.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/transpose.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Default/trim_trailing_white_space.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/Diff/diff.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/HTML/html_completions.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/User/close_tag.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/User/python_codeintel.py
Reloading plugin /Volumes/HOME/douglas/Library/Application Support/Sublime Text 2/Packages/User/sublimelint_plugin.py
SublimeLint: Successfully loaded linter jshint
SublimeLint: Successfully loaded linter notes
SublimeLint: Successfully loaded linter perl
SublimeLint: Successfully loaded linter php
SublimeLint: Successfully loaded linter python
SublimeLint: Successfully loaded linter ruby
pylint is not available
pylint is not available
SublimeLint: Successfully loaded linter sublime_pylint
loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
pre session restore time: 0.933785
startup time: 1.09041
loaded 1123 snippets
Traceback (most recent call last):
  File "./sublime_plugin.py", line 160, in on_query_completions
  File "./python_codeintel.py", line 300, in on_query_completions
KeyError: 39

Also how do i make pylint avaliable ? I tried installing pylint in virtualenv and in my system enviroment and it is still missing.

Thanks for the hard work =)

0 Likes

#31

When working with HTML things seem a bit wonkaloid. It only seems to suggest attributes that have already been applied to a tag elsewhere. So for instance, if I have

tags with class, id and role attributes, when I type <div I get a drop-down suggesting the class, id and role attributes. Otherwise, I don’t get any suggestions.

Is that correct behaviour?

Here’s a quick log of a fresh session editing an HTML5 doc

[code]Starting logging SublimeCodeIntel rev GIT-f26f633a (1308618629) on Wed Jun 22 09:05:08 2011

scan_multilang: path: u’C:\xampp\htdocs\susy\index.html’


Finished scanning, updating all scope names
Updating all class constructor names

CodeIntel(cplns, calltips) for C:\xampp\htdocs\susy\index.html@261 [HTML]

codeintel:done eval: success
Autocomplete called (HTML) [cplns]
scan_multilang: path: u’C:\xampp\htdocs\susy\index.html’


Finished scanning, updating all scope names
Updating all class constructor names
scan_multilang: path: u’C:\xampp\htdocs\susy\index.html’


Finished scanning, updating all scope names
Updating all class constructor names
scan_multilang: path: u’C:\xampp\htdocs\susy\index.html’


Finished scanning, updating all scope names
Updating all class constructor names

CodeIntel(cplns, calltips) for C:\xampp\htdocs\susy\index.html@261 [HTML]

codeintel:done eval: success
Autocomplete called (HTML) [cplns]
scan_multilang: path: u’C:\xampp\htdocs\susy\index.html’


Finished scanning, updating all scope names
Updating all class constructor names

CodeIntel(cplns, calltips) for C:\xampp\htdocs\susy\index.html@261 [HTML]

codeintel:done eval: success
Autocomplete called (HTML) [cplns]
scan_multilang: path: u’C:\xampp\htdocs\susy\index.html’


Finished scanning, updating all scope names
Updating all class constructor names[/code]

0 Likes

#32

@dsarch, I fixed the issue. Please pull the latest… about pylint, you’ll have to add it to your User folder I believe… or otherwise inside the “libs” directory inside SublimeLint.

@charlesroper, can you please be more specific? I couldn’t get exactly what you mean…

0 Likes

#33

@Kronuz I’ve created a screencast which might make it clearer:

dl.dropbox.com/u/256478/screenca … 2_1625.swf

While I’m here, I have another question: how do I add support for a new syntax (SCSS)? It would basically be the same as CSS with a few extras. In fact, could I simply add the .scss extension to make CodeIntel class it as a CSS file?

0 Likes

#34

@charlesroper, I think I know what you mean now… It must be a bug or issue with the underlying autocomplete in the codeintel2 engine (that comes from Open Komodo). I’ll have to look further later on, but it seems codeintel is uncapable of knowing what are the proper default attributes for div for some reason. That’s a nice screencast though… could you make some more screencasts to show the whole SublimeCodeIntel functionality? (note you can add, if you haven’t aready, a mouse binding so that when you command+click on a symbol (in python, or javascript or php, etc.) it takes you to the symbol definition (no matter in what file was defined). I’ve been wanting to have a screencast showing every feature, but I haven’t had the time…

Regarding SCSS, you can get my SCSS bundle fork, and use the Syntaxes/SCSS.tmLanguage file, it gets you the syntax. It has support for the latest Scss and compass: github.com/Kronuz/SCSS.tmbundle …If you want to add autocomplete for it, however, that’s not as easy. You’ll have to probably tweak and/or create a new SublimeCodeIntel/libs/codeintel2/lang_css.py lexer file and do more stuff… it won’t be as easy because CSS doesn’t use “imports” or anything but it can be done if you have the will. It would be nice to have SCSS code intelligence, finding mixins and user functions and all.

0 Likes