After i updated my VS to Version 17.3.0 Preview 2.0, i have a pop up info from VS and i want to disable it and i don't know how(and i don't know what question to ask google). If anyone knows or have a link to a similar question i will really appreciate.
(to bad i can't put a printscreen, i don't have reputation points)
Disable: template (template: "[action]/ .....)
value (Ok(value: products))
[Route(template: "[action]/{category}", Name ="GetProductByCategory")]
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult<IEnumerable<Product>>> GetProductByCategory(string category)
{
var products = await _productRepo.GetProductByCategory(categoryName: category);
return Ok(value: products);
}
Ty u.
It's called "Viewing inline hints" and I found it at link:
https://youtu.be/WCMb3V7nxms?t=398
For quick view (if it's disable) press ALT + F1 (on windows).
For permanent view: Tools → Options → Text Editor → C# → Advanced → (scroll all the way down) and Enable "Display inline parameter name hints"
Related
I have the following example layout on screen
How to enumerate these editors and their locations from within Plugin code?
Any hints please. Can't understand where to dig...
The following code
IdeFrame[] ideFrames = windowManager.getAllProjectFrames();
return only one entry
You can find all active/open editors by using the selectedEditors property of the FileEditorManager, and then ask each editor for their location on screen:
FileEditorManager.getInstance(project).selectedEditors.associateWith {
it.component.locationOnScreen
}
In Java that could be something like
Editor[] editors = FileEditorManager.getInstance(project).getSelectedEditors()
Point[] locations = editors.stream()
.map(editor -> editor.getComponent().getLocationOnScreen())
.collect(Collectors.toList())
(It probably depends on your context and what you want to do with it how you'd implement this, but you get the idea.)
when we working with java in Intellij we have fori key for auto complete a for loop but i could not find the same shortcut key for that when working with Kotlin in Intellij .
actually i have tried and found iter shortcut but it is for foreach i want auto complete of some thing like for (i in 0 until 10 step 3) .
can you help me find the correct key for that
I think iter is the closest you get out of the box; it is is defined in the live templates as:
for ($VAR$ in $ITERABLE$) {
$END$
}
Go to preferences then search for live, this will show you all the live templates. If you then open the Kotlin section in the tree on the right
you can make a copy of iter (using the copy icon) then you can edit it in the pane at the bottom. Call the copied template iteru and amend it to something like
for ($VAR$ in $START$ until $ENDV$ step $STEP$) {
$END$
}
If iter is displaying foreach it might be that intellij thinks the source file type is something other than Kotlin.
Logging Java in Intellij is easy with shortcuts such as 'logt', 'logd', 'loge'... and so on. But I moved to Kotlin, I noticed that those shortcuts doesn't work anymore. I don't know if it has something to do with my configuration, but if not, how can I fix this?
You should create separate templates to make them work correctly.
Here is the step-by-step guide:
Firstly, Copy and paste AndroidLog templates to Kotlin (Just select them and use CMD+C, CMD+V (or Ctrl+C, Ctrl+V)
Secondly, You have to adjust them manually:
1. logd (and others)
Select the logd item and press "Edit variables"
Change expression to: kotlinFunctionName()
Also, remove ; from the end of the template, as you don't need it in Kotlin.
Now your method name will be shown correctly
logt
This one is a bit trickier.
Solution 1 TAG = class name.
Template text :
private val TAG = "$className$"
Edit variables -> Expression:
groovyScript("_1.take(Math.min(23, _1.length()));", kotlinClassName())
Solution 2 TAG = file name (can be used inside Companion)
Template text :
private const val TAG = "$className$
or:
companion object {
private const val TAG = "$className$"
}
Edit variables -> Expression:
groovyScript("_1.take(Math.min(23, _1.length()));", fileNameWithoutExtension())
Edit 19.02.19
Also, it might be useful for someone.
In order to avoid creating the TAG variable, you can use the class name as a variable, for instance:
Log.d("BaseActivity", "onCreate: ")
Where BaseActivity is the class name.
The template will look now as:
android.util.Log.d("$CLASS_NAME$", "$METHOD_NAME$: $content$")
Where CLASS_NAME variable is:
groovyScript("_1.take(Math.min(23, _1.length()));", fileNameWithoutExtension())
These are provided in IntelliJ as a Live Template configuration for AndroidLog (found in Preferences -> Editor -> Live Templates), and are applicable specifically to Java code:
There isn't anything broken in your configuration, but if you want to make these Live Templates available for Kotlin you will need to add new Live Template for AndroidLog and make them applicable to Kotlin code.
https://www.jetbrains.com/help/idea/2017.1/creating-and-editing-live-templates.html
There's an open feature request to have them added as defaults here: https://youtrack.jetbrains.com/issue/KT-10464
Change the scope of the template in the applicable option.
In Android Studio 4.0 there's new AndroidLogKotlin block. You can implement #LeoDroidcoder's solution there.
MonoDevelop 3.0 is great, but it's a little too over zealous on reformatting.
When I enter the code:
var serializer = new XmlSerializer (typeof(TDestination),extraTypes);
Then press CTRL+SHIFT+F to format the code, it change these lines to put one parameter on each line making it hard to read when the function calls or lambda expressions are long.
var serializer = new XmlSerializer (
typeof(TDestination),
extraTypes
);
How do I get MonoDevelop to leave the line breaks as they are?
Go to Preferences >> Source Code >> Code Formatting >> C# Source Code. Select a custom policy, press the "C# Format" tab, and press the "Edit" button. I hope that helps!
In Visual Studio C# (2008), Ctrl+M+L expand all the regions.
There's also a setting in menu:
Tools -> Options -> Text Editor -> C# -> Advanced
to not collapse during file open. I see no equivalents in VB.NET.
Is there a way to expand all the regions, not just the one which has focus in VB.NET?
Or a macro or add-in that does it? I just hate not being able to see all the code.
In Visual Studio 2012 and 2013 there is an option for deactivating collapsing (called 'outlining mode').
You can find it under:
Text-Editor->Basic->VB Specific
and then uncheck "Enable outlining mode".
But you will then lose the feature for collapse/expand at all.
If you are willing to remove regions you can try this:
Ctrl+F
Quick Replace
Find Options
Use: Regular Expressions
Find What:
^\s*#(end)?region.*$
Replace with:
[leave replace box empty]
Explanation:
^ - Match the start of a line
\s* - Match zero or more whitespace characters
# - Match one # character
(end)? - Optionally match the string end
region - Match the string region
.* - Match zero or more of any other characters
$ - Match the end of the line
This will effectively find all #region or #endregion lines, whether they are indented or not, and whether they have description text after them or not.
In the Edit Menu, the Outlining submenu, you have all the options. Including Toggle All Outlining (Ctrl+M+L by default).
Maybe your key mappings were altered.
If you so desire, you can even select menu:
Edit -> Outlining -> Stop Outlining
In VB.Net, do a Search and Replace and select Use Hidden and Use Regex:
Replace:
^.*\#(end)*(:Wh)*region.*\n
With:
I wrote an extension to do this (and more), and it works for VB and C#. See this answer for more info:
Hiding the regions in Visual Studio
Once I changed:
#Region Form Level Events
#End Region
To (note the addition of quotes):
#Region "Form Level Events"
#End Region
The minus signed appeared and I was able to collapse/expand Regions.
That's pretty odd. The default profile settings for VB.Net and C# should bind the outlining functions to Ctrl+M, Ctrl+L combos.
It's possible that your profile is in a weird state. Try resetting your profile to VB.Net settings and see if that fixes the problem.
Tools → Import / Export Settings → Reset All Settings → VB.Net Profile
I came up with this trick:
Ctrl+F
Quick Replace
Find:
#Region
Search in: current document (or entire project or wherever you need to expand regions)
Search in hidden text
Then press Return and keep it pressed until VS notify the search is endend.
As a result all your '#region's have been expanded in very few seconds.