Jump to definition in whole workspace


Hi everyone, I’d like to talk about a feature that doesn’t yet seem to be present in c9 - that is, full ‘jump to definition’ functionality. I.e. the ability to hold down the control key and click a function and have the file open that contains that function. I understand that this can work if the function is defined in a currently open file. But am I correct that searching definitions in the whole workspace isn’t currently supported?

I’d have to say this is the main thing standing in the way of c9 being a viable alternative to offline IDEs (I use Eclipse). I’m really excited about cloud IDEs overtaking offline, but in the 6 months I’ve been using c9 I haven’t noticed many useful improvements (sorry guys). I’m looking forward to the day I can run a thinner client as my main development machine (Chromebook maybe?) but I’m guessing there are a lot of obstacles in the way of bringing something as complex as an IDE up to speed.

How can I stay abreast of improvements and functionality that may be in the pipeline, and contribute my feedback? I really like c9, and the flexibility in the environments (like ssh workspaces). This seems to be the future - keep up the good work.


To say more about functionality, I should give some context. I work with Drupal so I am using lots of API functions defined all over the code-base. I assume ‘code completion’ goes hand in hand with ‘jump to definition’ so this is part of my wish list too.


Yeah I am totally with you on this. I use PHPStorm, which is superb, but after playing with C9 I have been left so impressed with what is possible within the browser and it’s great for user collaboration.

However not being able to jump to definitions within the workspace does stop me using this permanently for now. Does anybody know if this feature is in the pipeline? The main things I need is opening PHP include files and CSS classes.

Another connected feature is when I am typing something like a class method I would expect a code hint to come up to help me complete the method name.



Cheers Mark, yeah it would be great to know what c9’s have lined up on this?


Hi. This is certainly an area we’re actively working on. Recently we improved support for jump to definition in PHP and Python. With PHP the support is still in early stages, and works best when you configure autocomplete include paths in the Project Preferences. With Python it works well for most libraries, and allows you to jump directly into library code and user code. For JavaScript we also have support, but as it provides more freedom in modularization it’s a bit harder so it’s not quite where we would like it to be yet.

Any feedback you guys have on this topic is appreciated; languages, frameworks, styles, etc. you’re working with and feel we could do more. We’re interested to learn more about your experiences there.


Auto-complete across multiple files works great! :smiley:

Though, it would be great if c9 would have something like /*global "link-to-other-file" */. That would be a lot less work than marking every single function that is used in multiple files as a global.

(A solution where the script tags from the main file are being parsed would be even better)


@stefnotch, can you explain how you implement auto-completion from a different file.

Suppose i have a file called ‘a.php’ containing a function ‘my_function()’. How can i call my function in another file ‘b.php’ without having ‘a.php’ open?


I always have both files open. In fact, I never noticed that both files need to be open.


Agreed. This is basically the one and only deal breaker for me in Cloud9 right now (as a PHP/Drupal developer). Having to do a workspace-wide code search for “function whatever_function” right now to find the definition multiple times per hour is driving me crazy.


This is also a super important feature for me and something I keep going back to PHPStorm form.

I tried playing with the autocomplete include paths but couldn’t get it working any better. It seems to index the current folder for jumping to a declaration. But in Drupal I need to add the entire /core/* path so I can jump to the base class definitions stored there. I tried adding “./core”, “/core”, “/core/*” and none of those seemed to make any difference, even after restarting my workspace.


autocomplete include paths in the Project Preferences

For JavaScript we also have support, but as it provides more freedom in modularization it’s a bit harder so it’s not quite where we would like it to be yet

I can’t seem to find any setting related to JavaScript autocomplete paths. Though, it seems that var something = require("./something.js") works perfectly. Is there a way to use it without it being a part of the program?

Currently, I simply defined require to be a function that returns nothing: function require(string) { return null; }


Javascript Autocompletion

When you use var yourLibrary = require("./somefile.js");, auto-completion works perfectly.

But, as you stated, require() doesn’t exist, nor do you want to have yourLibrary set to undefined. (Or to just throw an error)

As it turns out, C9 isn’t that smart:

    //Your library was defined in some other file
    var yourLibrary; //"This does nothing other than making C9 happy
    function require() {return 1;} //Define the require function
    if(false) {
       yourLibrary = require("yourLibraryFile.js");

Now, you can use autocomplete (it even shows the documentation comments)!

It seems to not always work.