Navigating to C++ function definition - c++

I'm looking for an easy way to find a C++ function definition in Visual Studio Code.
If I search with 'Find in Files' (shift-cmd-F) then it shows me ALL occurrences of the string pattern. This can sometimes give too many results, thus taking longer to locate the definiton.
I do know about the 'Go To Definition' feature, but that's if you find function symbol references. But I'm looking for a way to quickly type in the symbol and jump to all known definitions. I tried Palette Search (cmd-P) and the function definition isn't showing up there either.
I believe emacs has a feature like this. You would think vscode can do the same?

I found you can use symbol search, which works well only if you know the file to search.
Open the file. In the editor right-click and select "Go To Symbol In Editor" (shift-cmd-O on Mac) will open a symbol search and type in the function name.
Arrow down to the function name in the symbol list.

Even better than my other answer. You can "Go To Symbol In Workspace" (cmd-T on mac). Type in the symbol, arrow down to the right one, and hit enter.
I found initially it can take a few seconds to load symbols for a larger project, but subsequent searches for the same symbol are much faster.

Related

VS Code C++ rename symbol, skip comments

I'm using VS Code v1.51.1 on Ubuntu 18.04.5. I'm trying to refactor a C++ project. When I use Rename Symbol on grid symbol, its instances in comments are to be renamed too, see the right pane on the screenshot below (preview mode). I don't want that. Find All References is able to skip grid occurrences in comments as shown in the left pane below:
Is there a way to use Find All References list to guide the renaming?

How to get VS Code to propose more limited rename?

In Visual Studio Code, F2 rename on purely local C++ symbols is fine, but trying it on a symbol with wider scope, results in a very aggressive scope of suggested renaming, going as far as suggesting to rename unrelated symbols with the same name in the system header files. These typically default to unchecked, but at one point, it did rename an unrelated symbol with the same name in a project header, so it would be nice if the default could be dialed down a bit. Is there a way to do that?
The problem isn't with vscode, it's the linter vscode is using.
The easiest way to try to resolve the problem is using a different more advanced c++ linter. It's what I did to resolve a similar issue using golang.
Maybe the below link will help you find your new favorite linter.
https://www.reddit.com/r/cpp/comments/5b397d/what_c_linter_do_you_use/
PS: There is probably a setting that can edit the linter like what I am posting below, but based off of what you're asking, it may be difficult to find the right regex or whatever you need. It'd probably be best just to switch linters and then maybe make an issue on their github repository if you can't find one that suis your need.
"python.formatting.blackArgs": [
"--line-length=80"
],

Function Browsing In Spacemacs And CIDER

In Spacemacs, with an active CIDER REPL, is there a way to browse and jump to the functions in the current clojure-mode buffer?
I have tried cider-browse-ns. However, that appears to just display the functions and variables in the current namespace, along with their docstrings. The list cannot be used to jump directly to the function/var in the source code. I am also aware that g d will jump directly to the definition of the function under point. So the pieces of what I am looking for seem to all be available, I just cannot find how to wire them together.
An analogy to what I am looking for is IntelliJ's Structure sidebar.
It would be awesome if IntelliJ's Navigate -> Symbol functionality was possible as well. Searching for the function name, using /, comes pretty close (albeit without the handy fuzzy matching).
would SPC s j (help-jump-in-buffer) be what you search ?
Pressing backslash then S \s will help you jump to the definition.
Here is the list of the available commands in browse-ns. But since Spacemacs puts you in evil-mode by default, you should precede each command by a \ which temporarily disables it.

Looking up symbol documentation in Counterclockwise

In Counterclockwise, if I use CTRL-Space to complete a symbol name, and there are more than one possibility, it gives me a list, and on the right and side of the list is a box with the documentation for each symbol as I scroll through the names.
Is there any way to get this documentation window without using completion, or if there is only one option for the completion? Right now I am looking up documentation by deleting enough letters for the symbol to be ambiguous, then reselecting the symbol I want, but this is pretty inefficient. Usually I just want to know what order the arguments are. I'm not a huge emacs fan, but one thing I like about slime is that I seem to remember when I used it the status bar had a little list of the arguments for whatever function I was calling.
I've googled the problem and also looked on the counterclockwise web page, but I must be using the wrong search terms because I haven't come up with anything.
-Harry
You should be able to hover the mouse over the symbol, and the documentation will popup. Or press F2 while the cursor is over the symbol.

Visual Studio addin for mass breakpoints

When I'm starting with some big code I don't know. I find useful to me to search for a constant or function name and then add a breakpoint at all the references so I can begin to understand the code. Is there a VS adding to do that quickly ?
You could add breakpoint on function as described here.
I dont know that, but you can easily find all references by issuing Find All References in the right click menu.