While using of Visual Studio Code I've noticed that when I write function from autocomlete it never autocomlete with parentheses. For example:
fmt. //now select a function Print(a ...interface{}) from autocomplete
fmt.Print //why the parenthesehas have not been inserted automaticaly?
Is it always so in VS code or it is somehow related to the golang setting for VS code? Is there a way how to fix that?
In your VSCode settings (JSON) add the following line;
"go.useCodeSnippetsOnFunctionSuggest": true
Or if you are viewing your preferences/settings as the UI version, search for useCodeSnippetsOnFunctionSuggest and set it to true. This will
Add parentheses to the tailing end of function names.
Complete function suggestions with parameter signatures, including the variable types.
There is also the setting of go.useCodeSnippetsOnFunctionSuggestWithoutType which does the same, but omits the variable types.
You need the Visual Studio Code (Google Go Team maintained) Go extension installed which can be found here.
Related
I was using Visual Studio 2012 and it used to give the description of a property/method, which doesn't seem to work in VS2019. Is there an option that I will have to enable for this to work?
Below screesnhot is an example of File Input/Output operation:
When I scroll/hover over ios::app, it should give a description "Append to the end of the file" which it does not.
Second concern is that it is giving me a lot of other options as well (marked as * in VS). Is there an option to disable that permanently?
Final concern is that, when I hover over a function, it will display the parameters that the function is expecting (Or list of suggestions if the function is overloaded). But for some reason, in the below case, it is displaying along with namespace. Is there an option to disable that?
public static constexpr std::_losb::_Openmode std::_losb::app = (std::_losb::_Openmode)8
Using PyCharm, I would just type print and it would automatically add brackets once I pressed Enter. Is there an extension to this in VS Code?
So I would just have to type the name of, for example, a function I defined and while calling it, I would just type functionName and press Enter (return) and it would display: functionName()
For Python, with the Python extension from MS,
try settings -> Python -> Auto complete: Add Brackets
For javascript or typescript,
try settings -> javascript/typescript -> Suggest: Complete Function Calls
Try Pasting this in settings.json:
"python.analysis.completeFunctionParens": true
Basically, this feature is not available in VS code by default. You will have to look for an extension. I'm sorry to say but after extensive research, I was not able to find any suitable extension
Packages and methods in Visual Studio Code all auto complete after hitting tab (Golang), which is great, but I want it to complete the method and then put the cursor inside the ( ). I had it working like this on another machine but I can't seem to find setting/extension that does this.
Example:
// before hitting tab
fmt.Pri
// after hitting tab
fmt.Println
// would like this after hitting tab (with cursor inside parenthesis)
fmt.Println()
Any help is appreciated.
I finally found it. Inside your settings.json you need the following line.
{
"go.useCodeSnippetsOnFunctionSuggest": true,
}
I have the Go ms-vscode.go extension enabled, not sure if this is relevant but just in case.
There's a few issues about this on Github. Seems they don't want to implement it as standard because it would interfere when you want to type a function reference instead of a function call.
VSCode extensions can provide "snippets", which insert code based on a prefix and include the concept of tab stops. This is not really what you're looking for but I'll draw your attention to it anyway.
You can implement more advanced functionality with a language server that listens for events in the document. If you wanted to write it yourself, I think you would need to create a language server extension.
I'm using Visual Studio 2017 and I need to look at the binary representation of integer variables.
How can this be achieved from the Visual Studio debugger?
Type 'var, b' in the watch, for example:
According to the Visual Studio debugger documentation:
You can change the format in which a value is displayed in the Watch, Autos, and Locals windows by using format specifiers.
This note on debugging engine updates and compatibility is also worth noting:
When the Visual Studio native debugger changed to a new debugging engine, some new format specifiers were added and some old ones were removed. The older debugger is still used when you do interop (mixed native and managed) debugging with C++/CLI.
Although it mentions it can be applied to Autos and Locals windows, it is unclear how it is done as the variable names cannot be edited in those windows.
A <variable>, <format> syntax may be used in Watch and Immediate windows, like so:
Here is a direct link to the complete list of format specifiers.
Right-click the value it’ll show a menu list, but it only give us the option of Hexadecimal Display.
To display the variable with binary value in watch window, I suggest you write function to covert it :
The function that in my code is:
public static string ToBinaryString(uint num)
{
return Convert.ToString(num, 2).PadLeft(32, '0');
}
does someone might know how to search for a value in the locals
in visual studio 2010
or at least how can I expand all nodes, subnodes?
if you record a macro on activating locals tools window on VS2010 it will generated this line of code,
DTE.Windows.Item(EnvDTE.Constants.vsWindowKindLocals).Activate()
after debugging this code and inspecting DTE.Windows'ActiveWindow when the active window is local I unfortunately couldn't find anything helpful, but give it a try and you may find sth helpful
if you just need parameters of a method you can use MethodBase.GetCurrentMethod() in System.Reflection namespace and it will serve you well by this private memeber
((System.Reflection.RuntimeMethodInfo)(currentMethod)).m_parameters
that you can read programmatically by reflection or just quick watch it
There are several items here that would let you do what you need, but you'll likely have to tweak the code first:
http://www.codeproject.com/info/search.aspx?artkw=quickwatch&sbo=kw