Add Cmd+Click navigation to definition in Atom editor with Golang? - go

Does anyone know if it's possible to jump around code in a project by Control/Cmd+Click? I keep right-clicking and doing "Go to Definition" but that doesn't seem to work.

The "Go to Definition" option is built-in to Atom and requires ctags, which is a bit of work to set up for Go. Instead, you can install the navigator-go package, which will allow you to jump to definition with a keyboard shortcut.
If you prefer cmd+click as opposed to a keyboard shortcut, you can also install:
go-hyperclick **
hyperclick
* Note: navigator-go was recently renamed, and go-hyperclick still points at the old repo, so you may get some warnings about a missing package until this PR is merged.

Related

Anyway to use someone else's neovim/vim keybindings config on VS Code

I have just migrated from Atom, there, I was using Vim-plus but now on VS Code I have switched to neovim, but the problem is, there are many conflicting keybindings.
I tried to change them manually (something like, to close editor, 'Ctrl+c+t', which I mapped to close editor's tab, similarly others).
But I feel that's very unproductive and also can cause strain in my fingers. So any suggestions, or keybindings config of anyone which I can use alongside the NeoVim to increase my productivity. Or any other suggestions how to properly configure my VS Code?
NOTE: I know about the existence of an Atom Keybindings Extension which I honestly don't care, as I was mainly using Vim keybindings there and never bother to learn atom specific keybindings.
If you want VS Code to act like VIM, which is super unique in its interface and keybindings, there is an extension called:
VSCode Vim
VSCode Vim's Marketplace ID: vscodevim.vim
Personally I can't stand the VIM keybindings, so I don't know how great the extension is, but I know people who use it. It has 2.4 million downloads and counting. I also know, because of my buddy, that its not perfect, but it's close.
As with any other extension, don't just install it and hope it's what you wanted "out-of-the-box", this theme is customizable, and requires you to configure it. Make sure you read the README.md, and set it up so you know that it is best suited for your expectations.
If you are already using the VSCode VIM Extension, and you find that you are having conflicting issues using the keybindings associated with it. You can troubleshoot them using the keybindings troubleshooting tool by selecting it from the quick input menu.
Press F1
Type the phrase: "Keyboard Shortcut Troubleshooting"
Select the option "DEVELOPER: Toggle Keyboard Shortcut Troubleshooting Tool"
The tool should open in the console below. The menu might look like gibberish at first, however; the output of the newly opened console should make more sense once you use a familiar keybinding. Make sure that the console window is scrolled to the bottom and opened wide enough so your able to read everything logged. The tool will tell you what is attached to the keybinding your using, so you can see any conflicts that are happening, and what the key is set to do by you, by extensions, and by default.
Make changes to your keybindings.json file as necessary.

How to navigate to a certain type

I am looking for a way to navigate straight to a certain type of Go in VSCode. Specifically, a shortcut equivalent to :
CTRL+SHIFT+N in Intellij
CTRL+SHIFT+T in Eclipse
... both for Java code.
(When I say "straight to..." I mean from anywhere you are in VSCode, and not being already on a given type in code editor and use hover shortcuts - like F12. sure that one works fine)
I have already browsed... some links are talking about shortcut CTRL+T : but it does not the job as waited.
For instance i tried to navigate to type "Scanner" - which is in bufio/scan.go - but CTRL+T does not lead to this type in GO file.
Have you any workaround?
Assuming VSCode has indexed your project and you have the ms-vscode.go plugin installed, you can use the "Go to Symbol in Workspace" feature to navigate to types and functions in your workspace. Read more in the documentation.
As you mentioned, this does not find types outside of your workspace.
Press ⌘T or find "Go to Symbol in Workspace" under the "Go" menu.

Escape Doesn't Close Intellisense

I reinstalled VS2010 (new PC), and also installed VS2012. Both have the same issue: pressing escape does not close Intellisense, nor the method list (when you type a method name and press bracket, that little popup that appears showing you all overloaded versions).
How do I reinstate this? I checked through my keyboard settings but didn't find anything for this.
The keyboard command for it is, oddly, Edit.SelectionCancel, particularly in the "Text Editor" context.
The command also doubles as a useless deselect. Quite puzzling, like many other things in VS. I'd call it "IntellisenseClose" (and provide documentation for the available commands).
I suspect it's a VS extension. Go into Tools/Extensions and disable them one by one.
Resetting my keyboard shortcuts fixed this:
Tools > Options
Environment > Keyboard
Click "Reset" and Yes
Fixed!
I am indebted to this answer (and comment) for an explanation:
I have a theory. You type very fast... possible your opened a wormhole into the options screen as a result of fast typing and blew away the settings by accident? Just a thought.

How do you find all references to a method or property in Xcode?

If you have a method, e.g., loadMediaImages in a .h file, how do you find all references to that method in the project? In Visual Studio there is a "Find All References" option on the content menu when you highlight and click the method name. Anything similar in Xcode?
Using the "Search Navigator" it's possible to search for symbol references within a project or workspace. Click on the little magnifying glass icon in the search box to "Show Find Options", and then select the Style: Symbol References.
Note: This is in Xcode 4.6, but may have been present in earlier versions.
I was looking for similar option. I do not know why Xcode did not included that.
But there is a work around I use until Apple give that option in Xcode.
Try this in the source code (.m) file,
Select the symbol, right click -> Refactor -> Rename
-> Give a name whatever you wish, then press Preview.
Now you can see all the references. You can Cancel/do not rename it. :)
Or press Cmd + Shift + F, and choose optons Find > References > Matching or Containing. But it will search all text with similar name. Not elegant like Refactoring.
You could do a search in the whole project... I don't have a screen ready but I know Xcode can.
Haven't seen this in Xcode. Just FYI you are able to do that with AppCode though.
If I'm not mistaken, Xcode 4 (not sure about previous versions) does not support a Find All References search. You can perform a text search within the entire project by pressing Shift+Cmd+F (Find in Workspace in the Edit menu), but this does not find exact "references", just matching text. You're best bet is using the Refactoring menu, as talked about in Finding all references of a variable or a method in Xcode4, but it is not very clean and requires more work than it should.
Find selected symbol in workspace is what you need
right click on the method/property -> Find -> Find selected symbol in workspace
focus the property/method and press ⇧ + ⌃ + ⌘ + F (or you can have a custom one)
Does basically the same search as Refactor -> Rename does

Type ahead autocompletion in Eclipse

Do Eclipse have a plugin for type ahead autocompletion like Visual Studio, so I don't have to destroy my spacebar by pressing Ctrl+Space all the time? (If you don't know how it works in Visual Studio, please don't bother answering.)
And also, can I limit the autocomplete to imported packages, rather than every single Java class on earth? It's fustrating seeing suggestions from awt and swing etc., when I'm working with GWT. And I don't want to add every single Java class to the filter, that's just stupid. (Again, like how it's done in Visual Studio!)
Regarding your second part, yes you can
Open Eclipse
Select Window/Preferences from the menu
Expand Java/Appearance/Type Filters from the menu on the left
Click the "Add package" button, enter "java.awt" (without the quotes) and click OK
OK your way out
This will make Eclipse remove any matching classes from the java.awt package from your type ahead list. Very nice...
So "type-ahead" exists in Eclipse (mentioned in this status report in June 2006), but is synonym of auto-completion, most often triggered by CTRL+ Space... (which is not exactly what you are looking for)
To be more specific, the kind of automatic auto-completion (completion while you are typing, with a "Common" or "All" list of possible completions) you have in Visual Studio is not there in Eclipse (actually read below):
Original answer January 2010:
At least, not without a dedicating plugin.
And even with that plugin, it would have to follow a TemplateCompletionProcessor, meaning it would need a list of characters triggering said completion (again, not what you are looking for), by redefining method getCompletionProposalAutoActivationCharacters().
Update November 2011:
Cristi mentions in his answer (upvoted) a great workaround, which consists adding all the letters as Auto activation triggers for java.
See also "Automatically opening completion window in Eclipse".
From the thread "Eclipse auto-completion ":
Windows -> Preferences -> Java -> Editor -> Content Assist
Set delay to: 0 (actually >0 is better: 50, it avoids CPU picks because of constant listening)
Set triggers to:
.(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ#
My answer may come too late, but maybe will help others searching this feature in eclipse.
This workaround works for me (eclipse helios):
Go to Windows -> Preferences -> Java -> Editor -> Content Assist.
Here, enable Auto activation and set Auto activation delay to a low value, let's say 50 ms.
Then comes the workaround: In Auto activation triggers for java, simply put all the characters: abcdefghijklmnopqrstuvwxyz.
And there you go, just type something.
Completion is triggered when pressing ".", if that is what you are referring to as "type-ahead autocompletion". This is what Visual Studio also does, unless you are referring to another Visual Studio feature I'm unaware of.
Limiting completion to only imported packages I think is a somewhat unorthodox thing to do; you are forced to rely on wildcard imports to define the set of types to complete on. I think most users would consider that less than useful. You're welcome to elaborate on your use case for this, though. For example, why would you want to exclude all Java classes from completion?
BTW, using "type filters" (as VonC suggests) doesn't require you to add every single class. I typically (globally) exclude java.awt.*, sun.com.*, org.omd.*, and a few others. Eclipse also sorts completion according to a (type-sensitive) heuristic which usually results in the most relevant types being displayed at the top. For example, auto-completion inside a method call will put the variables which matches the method type signature at the top.
I know that Claus spoke of Java in the second part of his question, but the general question is about any language in Eclipse (no Java tag here), so the following might be of use to python eclipse coders:
Go to Windows -> Preferences -> PyDev -> Editor -> Code Completion. Here, check the box next to "Request completion on all letter chars and '_'?".
(Purposefully similar to Cristi's answer.)

Resources