Git Product home page Git Product logo

cscopesublime's People

Contributors

ageekymonk avatar ameyp avatar blockbomb avatar julianchurchill avatar ncmiller avatar nh2 avatar squary avatar vanrijn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cscopesublime's Issues

Database build and rebuild should use 2 different commands

From the tail end discussion of issue #56, I think there's some cleanup needed around the cscope database generating and rebuilding.

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.

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.

But I would like to at least separate the "first time build" and "rebuild" logic for the cscope database because I believe these should actually be different arguments passed to cscope.

Obligatory 'doesnt work in ST3' issue

Tried to use this in ST3 and it doesn't appear to work. (may track issues down later when I have time)

The new goto_definition and goto_symbol_in_project commands don't seem to work very well for some cases (like struct tags etc)

Jumping To Search Results Is Too Sensitive

I would like the search result buffers that are opened to act like the built in "find" search results, where you can click around the file and not jump to that selection until you double click.

I see it working like this let me know what you think.

  1. Cscope for your symbol/definition/callers/callees
  2. results window comes up
  3. you can navigate the results window and not jump anywhere until you
    either
    a) hit enter on the line
    or
    b) double click the line with your mouse.

right now if you move the cursor it will jump as soon as it hits a line it can decipher as a file name. This is due to the fact that the event it waits on is the selection changed I'm not well versed in the Sublime API but we should change that for a different event or at least add some thing there to not always evaluate until the users wants it to.

I will look into it more but if anyone has any ideas they will be much appreciated.

Display Cscope result in the other column in 2-column layout

Thanks a lot for developing this handy tool.

(Maybe I missed something, but..) I'm wondering if it is possible to display the Cscope results on the other column in the 2-column layout. Currently, I always manually drag the Cscope results to the right column if the looked up variable is on the left column.

Thanks in advance. : )

User configurable database location broke default case

I tried doing a CscopeSublime search and it didn't work. I added some debugging and I see this in the console:

add_to_history
[] []
Doing update database.
database setting found
Traceback (most recent call last):
File "./sublime_plugin.py", line 356, in run_
File "./cscope.py", line 207, in run
File "./cscope.py", line 262, in run_cscope
File "./cscope.py", line 180, in update_database
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py", line 119, in dirname
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'

The problem, IIUC, is that by not providing arguments to get_setting(), the default of None is used and then None is compared to an empty string. I've fixed this by providing an empty string default value. Pull request forthcoming.

Cscope commands do not work in the Cscope output window

It would be nice if you could run Cscope commands when looking at the output pane of the previous command you ran. I tried to do this and got confused because it fails silently with no error message.

In the Cscope output window, press Ctrl-, select Lookup Symbol (or any other command) and press enter. Nothing happens, but the console shows this message:

Traceback (most recent call last):
File "./sublime_plugin.py", line 356, in run_
File "./cscope.py", line 364, in run
File "./cscope.py", line 315, in update_database
File ".\posixpath.py", line 119, in dirname
AttributeError: 'NoneType' object has no attribute 'rfind'

I am using Sublime 2.0.2, build 2221 on Ubuntu 12.04.2 LTS.

Cscope ERROR: ['cscope', '-dL', '-f', 'D:\\u\\cscope.out', '-1Set_TTT_k'] failed!

I have problem using any find features in the plugin.

I have copied the win version of cscope to the windows directory. I have also used the -R argument to generate the database in the code base.


Sublime Text

Cscope ERROR: ['cscope', '-dL', '-f', 'D:\u\aaa\SandboxArea\CP1.51_O_P3\P3\cscope.out', '-1Set_TTT_k'] failed!

OK

TypeError: 'NoneType' object is not subscriptable

Hi, every one,
I got this error on Sublime Text 3,

Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 812, in run_
return self.run(edit, **args)
File "/home/wittmann/.config/sublime-text-3/Packages/CscopeSublime/cscope.py", line 467, in run
self.database.update_location(self.view.file_name())
File "/home/wittmann/.config/sublime-text-3/Packages/CscopeSublime/cscope.py", line 60, in update_location
project_info_paths = [folder['path'] for folder in project_info['folders']]
TypeError: 'NoneType' object is not subscriptable

Thank you,
Dmytrii

Add a thread for background processing

Instead of performing Cscope queries in the main thread (thereby causing the editor to freeze while cscope is returning the results), display a status message and run cscope in a separate thread, returning the results to the editor when that thread finishes.

Possibility to add all results to a list and navigate through them?

Hi,

first of all thank you very much for this nice plugin.

Is it possible to add all the results into the history list and navigate through the list via ctrl+shift+[ ?

the current implementation won't clear the list when querying new symbols, and I can't afford manually hitting enter on every result.

btw, is it possible to update cscope_out automatically?

Search for symbol/definition doesn't show any results

I have installed the cscope sublime plugin on Linux for Sublime Text 2. It doesn't show any results on UI even when the console says 'cscope database' found.

I just see this empty screen:
Screen Shot 2019-08-27 at 10 48 48 AM

Here's the console output:

('CscopeDatabase: Database found: ', u'/Users/.../.../cscope.out') add_to_history ([u'/home/.../.../myCat.c:526', u'/home/.../.../myLock0.h:247', u'/home/.../.../myLock0.h:278', u'/home/.../.../myCat.c:529', u'/home/.../.../myCat.c:526', u'/home/.../.../myLock0.h:294', u'/home/.../.../myLock.c:90'], [])

-- I have abbreviated the file paths/ file names/ macro names etc above.

Any help is appreciated. :-)

Results page tweaks

In comparing the results buffer for CscopeSublime to the Emacs/Cscope results buffer, I think the Emacs/Cscope results buffer is a little easier to read. Here's what it looks like:

cscope

Specifically, the Emacs buffer has:

  1. A line at the top of the buffer that gives the user context. In this example, the search type was a "global definition" and the search criteria was "schedule".

  2. An ASCII line separator ("-------"), separating the search criteria from the results. This helps to break up the results page a little and gives a clean separation, I feel.

  3. The file that contains the search result is listed on its own line and is colored differently from the actual result text. All lines that match the search criteria appear on their own lines that list the line number as well as the actual matching text. If there are multiple matches in a single file, the file is listed once with the results listed individually below the file. I feel that this separation makes it a little easier to focus on the result text since the lines aren't as busy and the thing that you're looking for (the result text) is more to the left of the buffer since it's not being pushed to the right by the filename being on the same page.

I would like to help make these changes. Would you be open to them? And if you have any pointers on where I should start making changes, that would be greatly appreciated too, since I'm new to python, SublimeText, and ST plugins. =:)

Thanks again!!

Cscope not working

Looks like something is missing for cscope

In folder /home/{username}/volume/db

Found 0 matches for egrep pattern: db_table

cscope error on ST3 " 'ascii' codec can't decode byte 0xe1 " with OSX10.12

I once had CscopeSublimeSearchWorker has no attribute "output" so I used Package Resource Viewer to add self.output = "" for Worker class.
It now does not provide any error for such, but I still get only empty file opened when I type commands for cscope.

And here is the new(or existed but ignored because of above error) error that I get when I launch cscope.

Traceback (most recent call last):
File "./python3.3/threading.py", line 901, in _bootstrap_inner
File "/Users/LazyRen/Library/Application Support/Sublime Text 3/Packages/Cscope/cscope.py", line 397, in run
matches = self.run_cscope(self.mode, self.symbol)
File "/Users/LazyRen/Library/Application Support/Sublime Text 3/Packages/Cscope/cscope.py", line 377, in run_cscope
output, erroroutput = proc.communicate()
File "./python3.3/subprocess.py", line 920, in communicate
File "./python3.3/subprocess.py", line 1577, in _communicate
File "./python3.3/subprocess.py", line 848, in _translate_newlines
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 67: ordinal not in range(128)

how to create cscope.out

Hi:
I use sublime text3 and try to create cscope.out, but I don't know how,
my environment is Windows 10, and I have download cscope.exe
Thanks

OSX10.11 sublime-text3 install failed, can not find Cscope.sublime-settings

I installed this plugin through Packet Control, after install finished,I find that nothing exited in the packet dir ,but I can find Cscope.sublime-package in /Users/chenji/Library/Application Support/Sublime Text 3/Installed Packages/Cscope.sublime-package,
It guess something wrong happens but no hit pop out.

In Windows path for cscope.exe should be configurable

In Windows, cscope is downloaded as a standalone executable. User can place it any of his convenient location. It would be better if we can configure the path for it in cscope rather than updating the PATH variable.

The search results doesn't support jumping to the matches.

For example, when I use seaching cscope for functions of calling this function, I'd like the search result support to jump to destinations like Sublime Text 3's own seach in files result, you can double click the line number to jump to the destination in the result page.
Sorry for my poor English expression and expect you can improve the plugin, thanks!

CscopeSublime not working in ST2

Hi!

I just installed CScope on Mac OSX 10.10 and tried to use this plugin in ST2, but it's not working in the current state. When running any commands (Cmd + \ and enter, Cmd + L/Cmd + S, ...), the console is outputting

Traceback (most recent call last):
File "./sublime_plugin.py", line 356, in run_
File "./cscope.py", line 424, in run
File "./cscope.py", line 57, in update_location
AttributeError: 'Window' object has no attribute 'project_data'

From what I gathered from a quick Google search, project_data is only available in ST3. I could fix the issue by adding a line that checks if project_data in an attribute of window() on line 57 of cscope.py:

if hasattr(self.view.window(), 'project_data'):
project_info = self.view.window().project_data()

I didn't try on ST3, so I don't know how it behaves there. I would assume that it sill works though!

Cheers!

Error when trying to load "Lookup Results.hidden-tmLanguage"

error: Error loading syntax file "Packages/CscopeSublime/Lookup Results.hidden-tmLanguage": Error parsing plist xml: Failed to open file In file "Packages/CscopeSublime/Lookup Results.hidden-tmLanguage"

Happens when the plugin opens a tab for it's results.

It would be nice to confirm or edit symbol to lookup

I'm coming from Emacs to Sublime Text and I'll just say that if this Cscope plugin didn't exist for Sublime Text 2, I would not be using ST2. So THANK YOU very much Amey! =:)

But there's a couple of things that I really like in the Emacs/Cscope integration that aren't there (yet =;)) in CscopeSublime that I'd like to help add.

This first issue is around the user interaction before the Cscope database is searched. In Emacs, the user is allowed to confirm or change the symbol that is being looked up before the database is searched. I use this all the time in Emacs to lookup a symbol that I'm looking for even though I don't know where it is in the source code. For example, I'm doing code review for a colleague and they use the constant FOO_BAR_BAZ. In Emacs, I can open any source file, start a Cscope symbol search for whatever my cursor happens to be on, and when Emacs prompts me for the symbol to lookup, I can change it to FOO_BAR_BAZ.

The Ctags Sublime plugin works kind of the same way in that it pops up an editable menu/list at the top of the window that the user can use to type in and narrow his search results down. I think it would be really nice to provide this same kind of functionality to CscopeSublime.

What do you think?

And I'm more than willing to dive in and add the code to do this, but I wanted to check with you first to see if you'd be open to it.

Thanks very much!!

Conflict in default key bindings of Sublime Text 3 & CscopeSublime

I installed this plugin recently and I'm really thankful that it is actively maintained.

Now after installing the plugin, two of my frequently used keybindings failed because of the following conflicts:

 [shift+super+[]
   prev_view                                Default               
   goback                                   Cscope                
 [shift+super+]]
   next_view                                Default               
   forward                                  Cscope                

Could we please ensure that there're no conflicts with at least Sublime Text 3's default key bindings? I can open a pull request if we decide on non-conflicting key bindings.

Fuzzy Searching for Cscope Symbols

I have no clue how to implement this but I really like the fuzzy finding of files in sublime text [ctrl+p] and if we could somehow create a fuzzy search for symbols without totally destroying responsiveness we should try what's the worst that could happen.

the problem is that sublime text 2 has a list of all files in a project ready to be processed where CscopeSublime has to query the Cscope database to get it's dataset to process. if there was a way to get the list of every symbol in the database and perform a fuzzy search algorithm on that fixed set we should be able to make something work.

then create a function that the users begins to typing in what they think the symbol is and CscopeSublime pop's up options to querty the Cscope Database with. Not a high priority but would certainly make the plug-in stand out. this could be a great addition to #8

Plugin is broken on Sublime2

Hi,

I am tying to configure sublime for linux kernel development and found this plugin.

Unfortunately it looks like the plugin is broken and I cannot use it at all (not searches). Reading the documentation it looks like it misses a lot of features such as navigate with mouse click, navigate back... I wish sublimecscope was more feature compatible with sublimectags https://github.com/SublimeText/CTags

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.