Comments (12)
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.
Here's what the Emacs/Cscope options look like:
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.
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.
@vanrijn Have you started working on this yet? Need help with anything?
from cscopesublime.
Hey Amey, no, not yet. I just haven't had the time yet.
from cscopesublime.
No worries :)
from cscopesublime.
I was just starting to look into this a bit. There's a couple of ways of doing this:
-
Always prompt the user to confirm via an show_input_panel (this would require 1 additional keystroke of ).
-
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.
-
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.
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.
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.
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.
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.
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)
- Add an option to create/refresh Cscope database HOT 3
- Display Cscope result in the other column in 2-column layout HOT 3
- Cscope not working
- request: Building cscope.out from sublime HOT 1
- Cscope ERROR: ['cscope', '-dL', '-f', 'D:\\u\\cscope.out', '-1Set_TTT_k'] failed! HOT 6
- OSX10.11 sublime-text3 install failed, can not find Cscope.sublime-settings HOT 5
- CscopeSublime not working in ST2 HOT 6
- Cscope: "Rebuild database" does not create cscope.out if one does not already exist HOT 8
- The search results doesn't support jumping to the matches. HOT 1
- in search window can not go to definition if the file in not opened in sublime. HOT 4
- Cscope ERROR: cscope binary "/usr/local/bin/" not found! HOT 14
- TypeError: 'NoneType' object is not subscriptable HOT 5
- All the previous Cscope results files open for every new lookup HOT 5
- Database build and rebuild should use 2 different commands HOT 1
- how to create cscope.out HOT 2
- How to change the hot key in sublime text3? HOT 3
- cscope error on ST3 " 'ascii' codec can't decode byte 0xe1 " with OSX10.12 HOT 11
- Conflict in default key bindings of Sublime Text 3 & CscopeSublime
- How can I use different database_location for different project?
- Search for symbol/definition doesn't show any results
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cscopesublime.