sourcegraph / srclib

srclib is a polyglot code analysis library, built for hackability. It consists of language analysis toolchains (currently for Go and Java, with Python, JavaScript, and Ruby in beta) with a common output format, and a CLI tool for running the analysis.
https://srclib.org
Other
942 stars 62 forks source link

installed in sublime text 3, after installing src - nothing #64

Closed BobWalsh closed 9 years ago

BobWalsh commented 10 years ago

in SB3 build 3065, installed via package control Sourcegraph. Restarted ST3. This after installing src successfully. See the two commands in the popup menu - but nothing happens.

beyang commented 10 years ago

Are the commands grayed out or active? Do you see any print-out in the Sublime console (accessible via ctl-\``)? Does running thesrc do-all` on the repository directly output a .srclib-cache/ directory? Do you have other Sublime plugins installed that function properly?

The editor plugin is a very thin layer on top of the src command line api (https://srclib.org/api/describe/), so if the src command works, then usually the editor plugin works, too.

samertm commented 10 years ago

There's a chance that "src" isn't on your path, or that sublime has a different path from your terminal.

In sublime text, hit "ctrl-`"to open up the console, and paste the following:

import subprocess; subprocess.check_output("src --help", shell=True)

If this errors (it'll look like subprocess.CalledProcessError: Command 'src --help' returned non-zero exit status 127), that means the src tool isn't on your path.

If it doesn't error out, let me know!

4hwwmuse commented 9 years ago

I'm having the same problem. I think Samertm is right, but how do I fix that? I'm running OS X Yosemite.

samertm commented 9 years ago

If you're using Sublime 3, there's a setting in Sourcegraph.sublime-settings for picking your 'src' tool called "which_src": https://github.com/sourcegraph/sourcegraph-sublime/blob/master/Sourcegraph.sublime-settings

It should be in your sublime packages directory under sourcegraph-sublime. Set it to whatever the path to your src program is (in my case, "/home/samer/code/go/bin/src"). Let me know if you need help finding it or that doesn't work.

4hwwmuse commented 9 years ago

Thanks Samertm. I'm trying to find Sourcegraph.sublime-settings on my machine, but can't seem to locate it. Here is what I have in my home/Library/Application Support/Sublime Text 3 folder: screen shot 2014-10-24 at 11 06 46 am

Am I looking in the wrong folder?

Package Control shows the plugin is installed...

screen shot 2014-10-24 at 11 15 13 am

samertm commented 9 years ago

Hmm, you're looking in the right place. I think I misunderstood how Package Control works and didn't realize that I needed to update the tag for it to pick up the newest commit. I just created a new tag, and it should "take" on Package Control soon. In the meantime, you can install the plugin manually if you want (github.com/sourcegraph/sourcegraph-sublime), or I can ping this issue when the updated version is on Package Control.

Thanks for working through this with me!

4hwwmuse commented 9 years ago

Thanks, Samertm. I'll look for a ping when the updated version is on Package Control.

samertm commented 9 years ago

Sorry that took so long! I messed up the version number on sublime plugin, and Package Control refused to upgrade it. I just fixed that, and the latest version is on Package Control now. Let me know if setting "which_src" works for you! For the Atom plugin, we introduced a setting to add things to the path to make it more convenient to use, which you may need as well.

alexandre-normand commented 9 years ago

I'm having a related issue trying the sourcegraph integration in Sublime Text 3. I installed srcgraph using go get so src was on my path. Sublime Text didn't initially find it on my path (even though it is on my command-line path) but I then installed the Fix Mac Path package to help with this.

Now the error I'm getting is the following:

Error message: Command '['src', 'api', 'describe', '--file', '/Users/alexandre.normand/projects/gowork/src/github.com/alexandre-normand/everytimisawesome/Godeps/_workspace/src/github.com/danryan/hal/config.go', '--start-byte', '1017', '--no-examples']' returned non-zero exit status 1
b''
b'2015/04/02 09:27:35 GOPATH must be set.\nlstat /Users/alexandre.normand/projects/gowork/src/github.com/alexandre-normand/everytimisawesome/.srclib-cache/3d942cee6b6bc92b9fc76fa81d297f18edfea2d9: no such file or directory\nfailed to scan for source units: scanner [/Users/alexandre.normand/.srclib/sourcegraph.com/sourcegraph/srclib-go/.bin/srclib-go scan]: EOF\n'

There's a mention of GOPATH must be set but it looks like it might be a red herring. GOPATH is correctly set as far as I can tell.