spectacles / codecomplice Goto Github PK
View Code? Open in Web Editor NEWCodeIntel for Sublime Text 2 / 3
License: Other
CodeIntel for Sublime Text 2 / 3
License: Other
I mean, is this feature even presumed?
Let say, I have a base class:
class ABook
{
const TYPE_NOVEL = 'novel',
const TYPE_USER_MANUAL = 'manual';
const TYPE_COLORING_BOOK = 'coloring';
// ...
}
Then, in another file, I want to reference one of those constants:
class UsedBook extends ABook {
// ...
if ($this->type == self::TYPE_ /// <<< here, I need a list of all available types to be suggested
Doesn't work for me. Here's a console dump:
Done 'PHP' CodeIntel! Full CodeIntel took 44ms
Doing CodeIntel for 'PHP' (hold on)...
current triggername: 'php-complete-functions'
+ Event: Adding php-5.5 stdlib
Adding php-5.5 stdlib
+ Info: Could not complete last request in time!
Could not complete last request in time!
Probably this is not specific to CodeComplice, but to SublimeCodeIntel as well.
Let's say I have the following PHP class.
class aClass
{
private $bClass;
public function __construct(bClass $bClass)
{
$this->bClass = $bClass;
//$bClass-> works fine (pops up the method hints)
//$this->bClass-> doesn't work
}
}
How do I fix this?
Hi @wizza-smile,
When i want to use an element of $_SERVER variable, it suggest $DOCUMENT_ROOT
the code become to $_SERVER['$DOCUMENT_ROOT']
It is not correct. It should be $_SERVER['DOCUMENT_ROOT']
.
And some keys are missing, eg: HTTP_REFERER.
Could you resolve this (should check $_SERVER, $_REQUEST, $_ENV);
There seems to be a problem with CodeComplice on ST3 build 3088,
I'm getting lots of: (on startup)
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 272, in on_modified
callback.on_modified(v)
File "C:\Users\CZR\AppData\Roaming\Sublime Text 3\Packages\CodeComplice\CodeComplice.py", line 1516, in on_modified
sublime_scope = getSublimeScope(view)
File "C:\Users\CZR\AppData\Roaming\Sublime Text 3\Packages\CodeComplice\CodeComplice.py", line 416, in getSublimeScope
return view.scope_name(pos)
File "C:\Program Files\Sublime Text 3\sublime.py", line 737, in scope_name
return sublime_api.view_scope_name(self.view_id, pt)
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 18-19: invalid continuation byte
Tried to do some digging, turns out it could be a bad encoded .py file ? Of course I checked some, but all seem encoded UTF-8 (which is ok)
Win 8.1 x64, ST 3 3088, CodeComplice 1.1.3 (installed from GIT, not package manager).
Everything was fine untill the recent ST update.
Current status:
+ Warning: evaluating 'numberFormat' at ajax_form.php#8: could not resolve first part of 'numberFormat'
evaluating 'numberFormat' at ajax_form.php#8: could not resolve first part of 'numberFormat'
(tested custom function numberFormat() for above example)
See this issue for further details: SublimeCodeIntel/SublimeCodeIntel#474 (comment)
When I try to ctrl+click on a class Trait, I get this error:
evaluating 'Authenticatable' at User.php#13: could not resolve first part of '\Illuminate\Auth\Authenticatable'
From what I can see it get the right namespace and name, but it can't open it.
Hello there,
When I'm working with somewhat bigger code base, it's easy to cause a timeout.
Even after I excluded framework and all external libraries there's still chance to make the script timeout.
I suggest that timeouts should be configurable.
More like a question than an issue, but I wondered whether it was possible to provide more information around the completion text, things like:
This information would really help providing context and (at times) choosing the right completion.
Is it just me or contextual menu is no longer available after installation of CodeComplice ?
How can I change the "Jump to definition" key ?
Self reply: found it in the Default (OSX).sublime-mousemap
This should not be the default behaviour, imho. Still posting the issue in case it helps someone
Update 1.1.3 broke everything on every copy of Sublime Text I use (v3 on all)
Downgraded to 1.1.2 and works ok.
"CodeComplice.py", line 98, in <module>
from codeintel2.common import CodeIntelError, EvalTimeout, LogEvalController, TRG_FORM_CPLN, TRG_FORM_CALLTIP, TRG_FORM_DEFN
ImportError: No module named 'codeintel2'
Unable to parse binding {caption: Tag: Lint Selection or Document, command: tag_lint}
Logs before that one:
reloading plugin CodeComplice.CodeComplice
Traceback (most recent call last):
File "sublime_plugin.py", line 74, in reload_plugin
m = importlib.import_module(modulename)
File "./importlib/__init__.py", line 90, in import_module
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
As the title...
Is anybody else having problems with CodeComplice indexing projects after updating Sublime Text to a dev build greater then version 3111?
/**
* @property Order[] $orders
*/
class User extends ActiveRecord {
public function getOrders() {
return $this->hasMany(Order::className(), ['user_id'=>'id']);
}
}
The code above works in client code like:
$user = User::findOne($id);
$user->order[0]->(some Order methods or properties)
because of magic getter method.
SublimeCodeIntel and SublimeCodeIntel3 scaned all doc blocks properties and give me tooltip like property name, but now, after i install today CodeComplice and clean up index, it's broke!
Also i don't see anymore some tooltips if i type something like this:
$user->orders[0]->prod
it's must to complite like products
because Account
class have @property Product[] $products
in doc block
I have created successfully a custom auto-complete catalog for a library X(JavaScript language),
i've tried to put it on its own file for organisation purposes :
...CodeComplice/libs/codeintel2/catalogs/customX.cix
i've also tried to add it to CodeComplice.sublime-settings
under :
JavaScript.codeintel_selected_catalogs
alongside with jQuery
"JavaScript": {
"codeintel_scan_extra_dir": [],
"codeintel_scan_exclude_dir":["/build/", "/min/"],
"codeintel_scan_files_in_project": false,
"codeintel_max_recursive_dir_depth": 2,
"codeintel_selected_catalogs": ["jQuery","customX"]
},
...
But it is not working, and it works only if i put the entire custom library definition inside the JavaScript catalog located in :
...CodeComplice/libs/codeintel2/stdlibs/JavaScript.cix
Notice : I asked this question already at SublimeCodeIntel and got no answer.
Any help or suggestions would be more than appriciated and thank you.
Hi
I just did a clean install of ST3 - as I restalled my favorite plugins, I installed SublimeCodintel first (before I found this repo) -- then when tested the functionality using ALT-CLICK on a function name in PHP, I recieved this at the console:
Updating indexes for 'PHP'... The first time this can take a while.
Doing CodeIntel for 'PHP' (hold on)...
current triggername: 'php-defn-defn'
Done 'PHP' CodeIntel! Full CodeIntel took 304ms
**+ Warning: evaluating 'add_theme_support' at functions.php#18: could not resolve first part of 'add_theme_support'**
After searching for a bit I found this repo, and decided to switch (as recommended) to see if this would address the problem. Its the same thing with CodeComplice.
I also deleted all of the data in %userprofile%\.codeintel
and restarted ST3, tested again as advised. Same error. Thoughts? Thanks
Is this possible?
I would like to disable CodeComplice by default (in "User/CodeComplice.sublime-settings") and enable it only in some projects.
But it seems that "codeintel": false
is not working, CodeComplice is still working.
Regards,
Armando
As example below:
ternjs/tern_for_sublime#61
I don't remember when the issue starts occured, but today i try to use GoTo Definition of CodeCompilce to go to a method in current class, but it does not work.
This is error log:
Exception in thread scanning thread:
Traceback (most recent call last):
File "./threading.py", line 901, in _bootstrap_inner
File "./threading.py", line 858, in run
File "/Users/ptcong/Library/Application Support/Sublime Text 3/Packages/CodeComplice/CodeComplice.py", line 869, in _codeintel_scan
buf.scan(mtime=mtime, skip_scan_time_check=is_dirty)
UnboundLocalError: local variable 'mtime' referenced before assignment
I just check the CodeComplice.py, and it seem does not define mtime
variable if is_dirty = false
I never see manual autocompletion (ctrl + shift + space).
I remove .codeintel/ + sublime code intel plugin ... and install your plugin ...
Can you help me?
EDIT: after updating index (10 min indexing / medium project is working).... My mistake.
Advantage: is fast against last update CodeIntel ;).
Improve to future - better PHP code intelisense ... it´s little tragedy in comparing with PHP IDE (ie: PHP Storm , PHP Designer etc.)
See screenshot:
http://files.rjwebdesign.cz/i/20150213-142547---532x190---%25t---%25pn.png
Im looking for some CONSTANTS from Form object .. nothing given.
When I use tab to complete a method name, then the params only show if I use the ctrl+shift+space shortcut. If I manually type the brackets or put the cursor there, they show automatically.
@wizza-smile
When i working on Xenforo, even is first time or N time i open the project. when i request ctrl + space
suggestions, status bar display Info: processing..
and not hint suggestions.
If i typing fast, feeling SublimeText make high CPU and text typing is very slow - lag. (often issues when i working on vBulletin project)
Even when i type if($_SE
and request for if($_SERVER...
(that defined in CodeCompilce - CC std lib) sometimes have no suggestions. >"< sometimes it when i type slow it show @@.
For Info: Update indexing
or Info: processing...PHP: please wait
in first time opened project, after a few seconds, it show Timeout
.
Is working with large source like Xenforo include Zend, CC have problem while indexing/processing ?
You can try with Xenforo source code, and open any php file, then type if($_SE)
.. first time or N time, it often no display suggestions.
For high CPU problem, you should try with vBulletin source code, open any file and type
if($_GET['abc']) {
echo 123;
exit;
}
should type this fast and see it.
Given I have a function foo()
that accepts a string, doing the below should only auto complete strings (or maybe there should atleast be an option to).
$bar = 123;
$foo = "123";
foo( $ ); // should only show a completion for $foo, as $bar is of type int
I tried to dig into the code to accomplish this - however I got pretty lost! It seems codeintel2 can resolve the type from a variable, for example, $a = new Query(); $a-> // will show completions from Query
however in the case of autocompletions the autocompletions for current scope
doesn't seem to return type information, hence the information at that point is lost.
The problem appears when I established CodeComplice. When I delete CodeComplice, the problem isn't present. Thanks.
Bug to
{ "keys": ["ctrl+shift+a"], "command": "expand_selection", "args": {"to": "tag"} },
Select text inside a tag
Occurs nothing
Ctrl+Shift+A:
key evt: shift+control+a
command: expand_selection {"to": "tag"}
Traceback (most recent call last):
File "E:\Sublime Text 3\sublime_plugin.py", line 231, in run_callback
expr()
File "E:\Sublime Text 3\sublime_plugin.py", line 314, in <lambda>
run_callback('on_selection_modified', callback, lambda: callback.on_selection_modified(v))
File "E:\Sublime Text 3\Data\Packages\CodeComplice\CodeComplice.py", line 1598, in on_selection_modified
rowcol = view.rowcol(view_sel[0].end())
File "E:\Sublime Text 3\sublime.py", line 538, in __getitem__
raise IndexError()
IndexError
@wizza-smile
I prefer to use CodeComplice Goto Definition, (goto_python_definition command) than ST Goto Definition.
Today i catch a bug while go to definition of class Extended.
Select Collection
and choose Jump to Symbol Definition context menu, instead of open Collection class, it open SesssionInterface file.
class Session extends Collection implements SessionInterface
{
}
Please resolve this
I installed via Package Control
When I Ctrl+Click on a name I see this in the console and nothing else happens:
+ Info: processing `Python': please wait...
processing `Python': please wait...
No handlers could be found for logger "process"
/Users/anentropic/Library/Application Support/Sublime Text 2/Packages/CodeComplice/libs/codeintel2/lang_go.py:16: UserWarning: Unable to import zope.cachedescriptors.property
warnings.warn("Unable to import zope.cachedescriptors.property")
Exception in thread scanning thread:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 484, in run
self.__target(*self.__args, **self.__kwargs)
File "./CodeComplice.py", line 846, in _codeintel_scan
RuntimeError: Must call on main thread, consider using sublime.set_timeout(function, timeout)
In this https://github.com/yiisoft/yii2/blob/master/framework/web/Application.php \yii\web\Application
class we have documented properties like $session
and $user
, now i dont have compeltions in tooltip after Yii::$app->
like session
or getSession()
. I think this because in https://github.com/yiisoft/yii2/blob/master/framework/BaseYii.php BaseYii
class we have:
/**
* @var \yii\console\Application|\yii\web\Application the application instance
*/
public static $app;
There is 2 different classes. And i think plugin scan the first, when it should to scan both.
Also in https://github.com/yiisoft/yii2/blob/master/framework/base/Application.php \yii\base\Application
class we have a lot of documented magic properties, but tooltip offers only methods.
This is strange, because after "codeintel_framework_compat_mode": true
that setting all works fine, until this moment. Maybe plugin stopped read user defined settings?
Roaming\Sublime Text\Packages\CodeComplice\libs\codeintel2\tree.py:55: UserWarning: Not using codeintel's patched elementtree: this may cause problems
warnings.warn("Not using codeintel's patched elementtree: "
reloading settings Packages/User/Preferences.sublime-settings
I just catch the issues, first time when i type $(document).ready
and request suggestion, and it provides
$(document).ready(function(e){
// bla bla
});
Now it only show suggestions of CodeComplice, i just tried to disable CC by "codeintel": false
, and "codeintel_live": false
but it still not disabled.
I strongly believe this should not be happening. A lot of users are already using SublimeCodeIntel and this is a fork of the same project. I do think your new additions and your efforts are great @wizza-smile, and I still don't see what is the purpose of forking an already well established project with a very large userbase instead of directly contributing to it.
It is my believe that forking a project should not happen except under plea of dire necessity and with very strong justification; i.e., only when goals are very different, when people with commit access (core developers) don't accept features or patches from contributors, if core developers themselves cannot agree in what direction to go, or if core developers reject direction or use cases the community members want. None of the above is true in this case, and stating "competition" as an argument is not enough reason to split efforts for me.
The goals and roadmap I wanted for SublimeCodeIntel can be delayed/changed and put on the table for discussion, I'm a reasonable man; and the least I want is to hurt the project or see the userbase confused about what to use. For everyone's sake, I'd rather step down the project if my efforts are no good enough for the community.
If your concerns are that you want to be able to release new versions and have a big saying in what the direction of the project is, you are more than welcome to join the SublimeCodeIntel organization as a maintainer. We need all the help we can get and someone interested as you are and with the skills you have would allow for a faster growing project with more ambitious and bigger goals.
I propose we talk and build a roadmap and join efforts to find help getting the project's goals fulfilled. I hereby formally extend an invitation to join efforts instead of diverging them.
Like title, when i write a class in a php script (abc.php) and going to write __construct method, no suggestions show.
On first run, CodeComplice prompted me with the following message in a modal dialog:
An existing Python rule definition exists, and codecomplice wants to overwrite it with its own version. Is that okay?
How the ---- am I supposed to know how answer this question? What rule is it replacing? What is it to be replaced with? What is a rule? I can't actually view the file that it intends to modify because the modal dialog is preventing me from using my text editor. I have to decide right now with absolutely no context, no clear way to undo my decision, and in fact no way to even go in after-the-fact and figure out what I lost.
This is not helpful.
If there is a way to change keybindings mention it in the readme file, otherwise please make it configurable.
Hi! First of all, excited to see more code intelligence plugin development.
I'm struggling to find Coffeescript codeintel support.
CoffeeComplete Plus technically works. The problem is it's abandoned and has glaring bugs that make it mostly unusable. Though, that plugin seems to literally be the best chance at codeintel autocompletion for CS across IDE's like; Visual Studio, Komodo, Webstorm, Light Table, Atom. They all don't support it in any capacity.
Is there something about Coffeescript that makes it difficult to build this kind of functionality for? It seems to be rather popular otherwise (eg. Atom).
Relates to SublimeCodeIntel/SublimeCodeIntel#87
Hi,
I've noticed that if I have installed CodeComplice and completions package, e.g. "PHP Completions Kit", these completions are not appearing in Sublime's standard autocomplete (Ctrl+Space).
I like to use this package because these completions are not included in PECL catalog.
When I remove CodeComplice completely from Packages folder, PHP Completions become available.
It seems that it does not matter if I remove PHP from codeintel_enabled_languages
or set codeintel
setting to false
.
Can this issue be resolved in some simple way?
i have index updating every time when i write some Ruby(Rails) code like ActiveRecord::
Because of that i should waiting a while(10-20 seconds) before tooltip show me suggestions
There is no autocompletion at all.
When i typing 1.
i want to see all methods like abs
, abs2
, ago
, etc... But i need to trigger this manually.
Autcomopletetion work if i start typing first letters of method e.g. Time.n
, but tooltip also offers me none Time object methods or functions, like this:
Time.namespace :say_controller do
end
Time don't have namespace
method at all. It's a cross-language bug of plugin.
Also, when i typing chaining method calls, completion dosen't work, even manual, e.g. i have expression 1.hour.from_now
, i'm expect some completion when i type 1.hour.f
(hour
is a method, not property)
The tooltip doesn't wan't to display...
Edit.
I downloaded the version 1.1.0 from releases, and they work OK - the 1.1.1 version not
Testes on ST 3 Build 3070
When I write ( | is cursor position ) in CSS file:
position: |
and press to show autocomplete ( ctrl + shift + space ) - nothing display...
When I press space + shift, they display options (relative, fixed, absolute etc.)
In the other side, when I have code in HTML/PHP file:
<div class="some-class" | >
the tooltip display (attributes) when I press ctrl + space or ctrl + shift + space...
On update index i got follow exception:
Exception! /var/www/gui/public/js/services/UsersService.js:328 (JavaScript)
Traceback (most recent call last):
File "/home/alex/.config/sublime-text-3/Packages/CodeComplice/CodeComplice.py", line 906, in get_trg
trg = getattr(buf, type, lambda *a: None)(*args, **kwargs)
File "/home/alex/.config/sublime-text-3/Packages/CodeComplice/libs/codeintel2/buffer.py", line 208, in preceding_trg_from_pos
return self.langintel.preceding_trg_from_pos(self, pos, curr_pos, trigger_type=trigger_type)
File "/home/alex/.config/sublime-text-3/Packages/CodeComplice/libs/codeintel2/lang_javascript.py", line 580, in preceding_trg_from_pos
DEBUG=DEBUG)
File "/home/alex/.config/sublime-text-3/Packages/CodeComplice/libs/codeintel2/langintel.py", line 492, in preceding_trg_from_pos
trg = buf.trg_from_pos(p, implicit=False, trigger_type=trigger_type)
File "/home/alex/.config/sublime-text-3/Packages/CodeComplice/libs/codeintel2/buffer.py", line 175, in trg_from_pos
return self.langintel.trg_from_pos(self, pos, implicit, type=trigger_type)
TypeError: trg_from_pos() got an unexpected keyword argument 'type'
+ Info: Error indexing! Please send the log file: '/home/alex/.codeintel/codeintel.log
this happens not only with JS, with PHP i have same problem
I tried this :
"codeintel_scan_exclude_dir":["/build/", "/min/","/node_modules/","_doc","output","/^/"],
in javascript, but when I try to navigate to a symbol that is defined in multiple places, I get the wrong one (in an excluded path). A quick scan of the code seems to indicate that the setting is not used
and, while we are at it, what is the format expected here ? is it regular expression ? if yes,
does "/" signify the opening delimiter, or a "path" character ?
var x = 'simple string';
x.sli (use tab to autocomplete) -> x.slice()
When I write all the method by no using tab/autocomplete, after open ( the tooltip automatically open...
function simple(a, b , c) {
return a;
}
simple(5, <now underline 'b' in tooltip)
I just want to enable CodeComplice for only PHP,
"codeintel_enabled_languages":
[
"PHP"
],
but seems like this option does not works, CC still process when i'm working on Javascript.
@wizza-smile are you still maintain this project ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.