Git Product home page Git Product logo

Comments (12)

blockbomb avatar blockbomb commented on August 24, 2024

I would tend to agree with you on this one, it would be nice to set the symbol to query without having to have it under the cursor. but we should keep the streamlined ability to lookup directly under the cursor as I use this a lot minimizing keystrokes. maybe add a new function or hotkey to "query" or "find" in the database.

when ran, it opens an overlay or split with a default value of the text under the cursor pre selected such that you can change it if you desire or set search options like ignore case and etc...
ctrl+f,ctrl+s -> find symbol
ctrl+f,ctrl+d -> find defintion
ctrl+f,ctrl+e -> find callees
ctrl+f,ctrl+r -> find callers

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Here's what the Emacs/Cscope options look like:

Screen Shot 2013-03-10 at 5 33 15 PM

Basically, the current CscopeSublime functionality matches "Find symbol no prompting", I think. It's interesting to note that only one of the Emacs/Cscope menu items uses "no prompting". It defaults to prompting the user, which I think is a good idea by default.

Would it be offensive to pop up an overlay that lets the user confirm or edit the symbol to ask CscopeSublime to look up by default? It would mean that the keystroke would be ctrl+f,ctrl+s,enter (adding an enter key on to confirm the symbol). Maybe if it was configurable via settings to turn the confirmation prompt off?

What would be super cool, I think, would be to have a "Find in files..." type of functionality with CscopeSublime, where the user could put in whatever search criteria they want, defaulting to the word that currently has focus, and then allow the user to specify the type of search (Find symbol, Find global definition, Find functions calling a function, Find called functions, Find text string, Find a file, Find files #including a file), etc. And tie it to a "Cscope Advanced Search..." menu or something. Maybe something to keep in mind for the future.

Right now I'd just like to be able to do a symbol search and enter something not present in the file I'm viewing. =:)

from cscopesublime.

ameyp avatar ameyp commented on August 24, 2024

I agree, this would be a nice feature to have, and I don't think most users would mind an additional keypress. To get started, the best place would probably be sublime.active_window().show_input_panel(caption, initial_text, on_done, on_change, on_cancel) here. Please let me know if you get stuck anywhere.

from cscopesublime.

ameyp avatar ameyp commented on August 24, 2024

@vanrijn Have you started working on this yet? Need help with anything?

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Hey Amey, no, not yet. I just haven't had the time yet.

from cscopesublime.

ameyp avatar ameyp commented on August 24, 2024

No worries :)

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

I was just starting to look into this a bit. There's a couple of ways of doing this:

  1. Always prompt the user to confirm via an show_input_panel (this would require 1 additional keystroke of ).

  2. Add a new command to the plugin, like CscopeConfirmCommand that would prompt the user first, defaulting to whatever word(s) are selected. And then have the on_done call into the existing CscopeCommand. This would require at least one additional context menu with the text "Cscope: Look up symbol..."? I think that would be confusing, especially since we have 5 modes, so I wouldn't want to provide 5 new menu items or whatever.

  3. Provide a new config setting called "confirm_before_searching" or something that defaults to true, but allows users to disable the prompting behavior.

I don't like approach 2. I think approach 1 and 3 would be good.

What do you think?

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Oh... one other thing that confused me... It looks like there can be multiple words selected and multiple cscope searches going on at the same time?

        for sel in self.view.sel():
            symbol = self.view.substr(self.view.word(sel))
            worker = CscopeSublimeWorker(
                    view = self.view,
                    platform = sublime.platform(),
                    root = self.root,
                    database = self.database,
                    symbol = symbol,
                    mode = mode
                )
            worker.start()
            workers.append(worker)

Maybe if more than one symbol is selected, we don't prompt the user? Or am I misunderstanding this?

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Okay, it looks like the multi-select cscope lookup doesn't actually work today anyway? I get this error in the console when I try:

Traceback (most recent call last):
File "./cscope.py", line 319, in
File "./cscope.py", line 326, in update_status
File "./cscope.py", line 329, in display_results
AttributeError: 'NoneType' object has no attribute 'new_file'

So it looks like only the first selection is able to be searched? Or is this a bug/regression?

from cscopesublime.

ameyp avatar ameyp commented on August 24, 2024

Apologies, I've been remiss in my duties. Had some other stuff going on.

Actually, the multi-symbol search is that way solely because Sublime's view.sel() returns an array of selections. I haven't actually tested it to see if it works (and evidently it doesn't) so we could just pick the first selection and drop the rest. I've never actually felt the need to search for different symbols at once, have you?

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

Yeah, you're completely right. Okay, I'll add to this branch to make it clear that we only support one lookup, not multiples. =:)

from cscopesublime.

vanrijn avatar vanrijn commented on August 24, 2024

I'm going to open a new issue to track only doing a single query instead of multiples and close this one since this issue has been fixed. =:)

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.