I've moved over to VSC from ST3, but there is no namespace auto finder/user to my knowledge, do you know of a plugin to achieve this? - visual-studio-code

I've moved over to VSC (visual studio code) from ST3, my only problem is there is no namespace auto finder/use to my knowledge, do you know of a plugin to achieve this?
For example, if I done a method like so in sublime:
public function getJob(User $user)
{
//nothing just a testmehthod
}
and I pressed f5 over the User It'd import it, or if I pressed f6 it's include the full namespace... Any plugin for VSC like this?

VS Code does have a 'quick fix'. In C# it will auto add using statements if they are missing for the statement under the cursor. The default keybinding is "ctrl+." according to the vscode documentation keybindings page.
Not sure which language you're using so I cannot test it locally. I don't know which languages it works for or if other plugins are needed to work for more languages.

Related

IDE shortcuts - intelij IDEA to VSC

In intellij Idea, I could type "psvm" for a main method, and "fori" to get a for loop, and "sout" to get a system println, is there a way to customize intellisense in visual studio code to get the same behavior?
VSCode has many extensions that provide "snippets", shortcuts for code segments like you mentioned. The C/C++ extension which you might already have installed provides some for C++, such as main for a main method and for for a for loop. If you have the extension installed, snippets work exactly like other intellisense suggestions; you can simply type them and then press enter or tab to apply them.
You can also look for other snippet extensions by searching for #category:"Snippets" in the extension section.

VSCode not showing function parameter list in Dart code

When I edit JavaScript code, VSCode immediately show me a popup with a list of parameters as soon as I have typed a function name followed by (.
When editing Dart code this is not the case. Here I have to use the mouse to hover over the function name to show a popup with information about the function.
Is this normal behaviour? Are there any way to change this behaviour? Does anyone know a shortcut to show the popup?
This is controlled by a VS Code user setting in the Dart extension (dart.triggerSignatureHelpAutomatically). It's not on by default because there are some quirks (that I don't remember exactly off the top of my head).
There's work in progress to move the extension to using the LSP protocol which will push some of this functionality into the Dart analysis server, which may make it easier to make some functionality like this more reliable (since more info is available in the language server than is currently exposed to the VS Code extension).

Is there a way to turn off naming suggestions in a code snippet?

I'm writing Selenium page object classes in Java in Visual Studio Code. I created a custom code snippet that, when entered, looks more or less like this:
public WebElement ELEMENTNAME() {
return driver.findElementByCssSelector("CSSSELECTOR");
}
After I enter the snippet name and hit Tab, ELEMENTNAME gets the focus. I type the element name I've picked, such as ConfirmButton, and hit Tab...whereupon I find that my method now has the name ConfirmButtonElement, because VS Code decided to accept its own naming suggestion instead of what I typed.
How can I turn this "feature" off?
Usually VS Code's autocomplete suggestions are helpful, so I don't want to disable them entirely. But I definitely want to disable them in the case of naming things. Is there a way to do that?
(I'm not sure whether the behavior comes from VS Code itself or from an extension such as the Red Hat Java extensions.)
1. Extension to blame: It is actually happening because of Microsoft Java Extension Pack. Though it also includes the Red Hat Java Package
2. To disable this package: You can navigate to Extensions tab in VScode and search for Microsoft Java Extension Pack and click disable package.
I don't know when this may have been added to vscode, but have a look at:
// Control whether an active snippet prevents quick suggestions.
"editor.suggest.snippetsPreventQuickSuggestions": true,
true is the default, try false.

How do I remap the `Alt+Click` action in visual studio code?

according to the documentation here I can add multiple cursors in visual studio code by using alt+Click in the editor. Sadly alt+drag is already used by the window manager to move the window around, so visual-studio-code does not get any key events. So how do I change that keyboard configuration in visual studio code? I could not find anything in the default key combinations file.
I am not looking for solution that changes my window manager, I really like that behavior and use it very frequently already for a very long time.
The easiest way in my opinion is:
From the top-level menu, click on
Selection -> Switch to Ctrl+Click for Multi-Cursor
Then you can use Ctrl+Click rather than Alt+Click.
You can see where this is in this screenshot:
My VSCode version is 1.24.1
There is currently no way to do this but already an open issue on GitHub which addresses that.

Netbeans IDE Code Snippet Keybinding

I'm not sure if this is possible and if this is the right place to ask, but I'd like to give it a try. I'm currently trying Netbeans IDE, coming from Dreamweaver.
In Dreamweaver I can create Code Snippets and bind a key to them. So for example marking a text and pressing CTRL+B then, surrounds the text with the [strong] tag. Or I created a snippet, when I press SHIFT+CTRL+B it adds a [br /] tag at the position of the cursor.
I could not find a way to do this in Netbeans so far. Does anyone know if this is possilbe, and if, how to achieve this?
There is a Plugin available for that,
Go to Tools->plugins and try out TagMyCode
https://tagmycode.com/
I've been using it for quite some time, there is a library of public snippets and the doc is really helpful.