Git Product home page Git Product logo

Comments (14)

vanrijn avatar vanrijn commented on August 24, 2024

I think what you need to provide is "/usr/local/bin/cscope" as the "executable" for CscopeSublime's settings. You should be able to set this either in your project or user settings as "CscopeSublime_executable" or else just "executable" in CscopeSublime's settings file. It looks like you've done is set CscopeSublime's "executable" to "/usr/local/bin", which is not going to work.

from cscopesublime.

SongPeter avatar SongPeter commented on August 24, 2024

I have the same problem as you, in Mac on 10.12.5,sublime 3124,/usr/local/bin/cscope: version 15.8b
I provide is "/usr/local/bin/cscope", but it's still Cscope ERROR: cscope binary "/usr/local/bin/cscope" not found!

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

@SongPeter and @wanghui0574xs did you try setting CscopeSublime's executable configuration properly? Does /usr/local/bin/scope actually exist for you? Open a terminal and type /usr/local/bin/cscope and does it work? You're going to have to give some more information for this to be useful.

from cscopesublime.

zerolover avatar zerolover commented on August 24, 2024

CscopeDatabase: Rebuilding database in directory: ~
error: Cscope ERROR: cscope binary "/usr/local/bin/cscope" not found!
Exception in thread Thread-26:
Traceback (most recent call last):
File "./python3.3/threading.py", line 901, in _bootstrap_inner
File "cscope in /Users/xxx/Library/Application Support/Sublime Text 3/Installed Packages/Cscope.sublime-package", line 232, in run
File "cscope in /Users/xxx/Library/Application Support/Sublime Text 3/Installed Packages/Cscope.sublime-package", line 115, in rebuild
UnboundLocalError: local variable 'proc' referenced before assignment

However, I have install cscope by brew.

~ /usr/local/bin/cscope --version
/usr/local/bin/cscope: version 15.8b

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Ah hang on. Thank you @zerolover . Could you please do "ls - la /usr/local/bin/cscope" for me and paste the results here?

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Actually, I wonder if it could be the "~" as the cwd for the subprocess.Popen call too. @zerolover how is "~" getting set to your project or database root, do you know? Could you try setting this to a full directory path like "/Users/zerolover" ( for example... make sure it really exists tho...) instead of "~" and see if this works then?

from cscopesublime.

zerolover avatar zerolover commented on August 24, 2024

Oh, I have changed "database_location" to "~/tmp"... Now It doesn't show cscope not found.
I just right clicked the folder and select "Cscope: Rebuild database", it shows
CscopeDatabase: Rebuilding database in directory: None
CscopeDatabase: Rebuild done.

Finally I find a solution... just close the project I have opened(Project->Close Project) and drag the fold to the sublime, then I can use CscopeSublime. It's so strange since the CTags works fine~(https://packagecontrol.io/packages/CTags)

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

@zerolover Did you have "database_location" set since you started reporting problems on this issue? And what did you have it set to previously? Did you have database_location set to ~? And what do you have it set to now? And where does your database actually get created?

I'm having a hard time understanding exactly what's going on with your setup. It sounds like the error that was showing about cscope not being found was misleading. It sounds like the error was due to the "cwd" being incorrect, in the argument to subprocess.Popen. I'm trying to understand how it was incorrect. Can you please help me understand?

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Ok, I think this commit should fix this problem. Please verify, @zerolover and if you could answer my questions above, I'd sure appreciate it. Thank you!

from cscopesublime.

zerolover avatar zerolover commented on August 24, 2024

@vanrijn Actually I don't want to use the “database_location”, I just want to run the cscope and generate the cscope.out on the project dir....
And your commit doesn't solve the problem, but I can give you more detail.

I modified you cscope.py, add some debug info in function update_location() as following

def update_location(self, filename):
        ...
        print("1");
        print(filename)
        print("2");
        print(project_info)
        print("3");
        print(project_info_paths)

        # if the user provided database_location, validate it before using it
        database_location = get_setting('database_location')

And here is the output

1
None
2
{'folders': [{'path': '/Users/xxx/Desktop/spdlog'}, {'path': '/Users/xxx/Desktop/ar'}]}
3
['/Users/xxx/Desktop/spdlog', '/Users/xxx/Desktop/ar']
error: Cscope: No working directory found. Unable to rebuild database.

image

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Thanks for clarifying, @zerolover. So what is your expectation for what this plugin should do with your setup? The basic design is that cscope creates or finds a database in the root of your source code directory that indexes recursively the source code files inside that directory. Do you actually have a working setup right now, outside of this plugin, where you are using cscope with your source code in your environment? I don't understand how you have your environment set up, how your project works, or what it is that you're expecting this plugin to do given your setup. You mentioned that you have this working in a way you would expect with ctags so can you please help me understand what exactly that is doing? As you can see from the code you added debugging to, there's only 3 ways this plugin can work: 1) the user provides a single specific database location, 2) the plugin has a filename to work with and keeps working its way up the directory structure until it finds a directory that has a database file names cscope.out, or 3) by a single root project directory path existing to use as the database location. It sounds like none of these things exists in the scenario you're using? So can you please help me understand what you are expecting or what you think the right thing is for this plugin to do, given your use case. Thanks!! =:)

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Also I never heard back from @SongPeter or the original bug reporter @wanghui0574xs on this. Guys, I'm not sure if what @zerolover and I have been talking about is in any way related to the issue you were facing. Can you please let me know if you're still facing this issue after my recent changes and help me understand exactly what your use cases are? Thank you!

from cscopesublime.

zerolover avatar zerolover commented on August 24, 2024

@vanrijn sorry for that, I haven't used scope before...
Here is the CTags description, I think CscopeSublime should have the same funtion...
"The plugin will try to find a .tags file in the same directory as the current view, walking up directories until it finds one. If it can't find one it will offer to build one (in the directory of the current view)"

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Ok, thanks for clarifying @zerolover. ctags and cscope work differently in a lot of ways, so yes you're correct this works differently too.

Let's level set...

  1. I think this issue here was either:
    a) misconfiguration. executable or CscopeSublime_executable was not correct when specified via settings. I think this is the issue that the original post had as it looked like executable was set to "/usr/local/bin".
    b) a misleading error from this plugin. I think what could have been happening was the "cwd" that we were using when calling subprocess.Popen() was invalid and what was failing was the "cd" command, not the call to cscope itself. This should be fixed via my recent commits. I think this is the issue that at least @zerolover was facing and possibly @wanghui0574xs.

  2. CscopeSublime didn't use to ever let you rebuild or build for the first time a cscope database. This was a recent addition I made. We've not been getting a lot of requests for this ability, so I'm not really inclined to sink a lot of time into expanding this functionality. But I do think we could do database rebuild or first-time-build better, so I'll open another issue to track this.

  3. cscope's database building is complicated and non-trivial. The easy way to do this is to have a single source directory and run "cscope -R" on that directory to produce a cscope.out database file at the top level of that directory. But you can do a lot of variations on this approach. You can keep the database file in a different directory entirely by creating a cscope.files file that contains all the filenames you want cscope to index. You have complete control over what files end up in the cscope.files list too, so if you have a huge code base and only want to index the C or C++ files and not Java, Python, Perl, or whatever else, you can do this. But there's no simple way to do this in a way that will work for everybody. Personally, I have a shell script called cscope-indexer that came from an old Linux distro and probably https://github.com/To1ne/xcscope/blob/master/cscope-indexer originally that I use to build and rebuild my cscope database. Other people will have a variety of commands they use to build their cscope index, such as found here: https://stackoverflow.com/questions/11718272/build-cscope-out-files-in-a-separate-directory . I don't see an easy, elegant, and easy-to-maintain way to provide a solution that would work for everyone for this. So I think I'm going to intentionally try to limit the database building/rebuilding functionality that this plugin provides. If there's an existing cscope.out file that we can find, I believe there's a trivial command that we can do to rebuild it. If there's not an existing cscope.out file, but we know where it should go (i.e. a project that only has one path folder defined), we can continue to do what we're doing today and build it the first time. But I don't think I want to put more work into this than that. I'm certainly open to code contributions and pull requests if this functionality is wanted, but I just haven't seen any demand/request for it yet to justify the work.

I'm going to close this again. The dialog I've had with @zerolover is interesting but I don't believe it's the same issue as this issue was originally filed about.

I'll open another issue to talk about doing a better job of creating the database the first time and rebuilding it, since I think you want to use separate commands for doing these things usually.

from cscopesublime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.