Visual Studio 2022 auto prefix properties with "this" - visual-studio-2022

I would like that when I write the name of a property and I tab to autocomplete, it put "this" prefix automatically.
For exemple:
If I tab, I get this:
I would like to have this instead:
There are my visual studio settings, Resharper settings and editorConfig:
(Edit: I've opened a feature request: https://developercommunity.visualstudio.com/t/Visual-Studio-2022-auto-prefix-propertie/10221630)
(Edit 2: The language is C#)

This would need to be a feature request. You can submit that through VS with the Suggest A Feature on the feedback menu.
When you press tab to commit the completion item, the text to insert (or "insertion text") for that item has already been calculated. In most cases, it is the text seen (known as the display text), but sometimes the insertion text can be different (or even include edits other places in the document!). There is also the possibility, depending on how each language implements the completion feature, that the language can make additional calculations and edits as part of committing the item.
In either event (pre-computed or computed during commit), the language feature would need to make changes to include the this. prefix as part of the completion commit edit.
A possible alternative to waiting for a new feature would be to write an editor extension that monitors the buffer changes, and when it sees an applicable member inserted without the required this. prefix, it could then trigger its own edit automatically to insert it.

Related

Remove Attributes on Rubberduck VBA

I'm just getting into using Rubberduck for my VBA applications. I came across a great post on adding attributes here:
How to set the Attribute VB_PredeclaredId using RubberDuck '#PredeclaredID
However, what if I want to remove the attribute? It seems like the only way to do it is via code inspections. However, after you initially set the '#PredeclaredId, there's no longer any error that shows up. So the option to remove the attribute is no longer available.
I tried deleting the attribute, but the "Predeclared" annotation is still in my explorer:
I'm sure I can export, edit in the text editor, and then re-import again, but one purpose of rubberduck is to avoid doing that.
Thanks.
After deleting the attribute annotation there will be a new "attribute value out of sync" inspection with 2 options:
adjust attribute value
adjust annotation
You want to do the first option which will nuke the hidden attribute value.
Update
Another 2 alternatives:
indent the module ctrl+m
cut and paste the code ctrl-a ctrl-x ctrl-v
Both these options will wipe out the attribute values by forcing VBA to recompile the module without them. This is normally an annoyance (indenting my project wipes the attributes and I need to restore them with RD annotation inspections)
Final thing remember to refresh RD code explorer so it picks up the changes and the icon will change. This often happens automatically though.

Hide\remove language from VB.Net form list

Is there a way to make the language property list shorter? Make it show only EN-US and PT-BR, for instance, so it's easier to find them?
You probably don't need to do it.. You can likely just make your life easier like:
Make a new form, lets say it's called LocalForm.vb
Drop a label on it, lets say called HelloLabel
Set form to de-DE, set the text of the label to Hallo
Set form to fr-FR, set the text of the label to Salut
Set the form back to (default) - you now have LocalForm.resx, LocalForm.de-DE.resx and LocalForm.fr-FR.resx and you can add controls
Add a Button, called StartButton
Double click the LocalForm.de-DE.resx file
Dismiss the "if you mess this up you'll have to fix it yourself" dialog
Add a line for StartButton.Text Starten
Repeat for other language files
Dropping a control named XyzButton on the form, and then visiting each LocalFor.*.resx in turn and adding the locale for it is a lot easier than back-and-forthing with the language setting, though I know why it's done the way MS chose to do it - you're supposed to lay your form out perfectly with all its hundreds of controls, and then switch to French and write all the French for all hundreds controls, and then switch to German and write it all in German.. In a use case like that there isn't a lot of work to do with that awkwardly huge Language dropdown. Incremental adds that way are a bit of a pain..
Perhaps raise a connect bug/feature asking them to put the "already used" languages (as determined by the presence of Form.*.resx files) at the top of the list, and wait many years for it to be implemented :)
Note: There's a bit of a nuisance with this "edit the resx" in that if you rename a control it doesn't always get picked up. Last time I was localizing I threw together an app that watched (FileSystemWatcher) files named *Form.resx and if it saw a change (load the current version, compare to the prev version) that was a rename, it made the same change in the other files (or maybe alerted if they weren't in sync.. can't quite remember now and I've no idea where the code has gone)
Maybe don't rename your controls after you first decide a sensible name for them/add them to the translated resx..

What is MarkSelection in Eclipse, it will be used in what scenario?

I know StructuredSelection will be used when you select a file in Package Explorer for example, and TextSelection will be used when you select some text in Editor, but not clear about MarkSelection, when it will be used?
MarkSelection is generated by TextViewer (so usually a text editor) and reports a change to a 'mark' selection. It will only be sent to selection change listeners for the text viewer.
The TextViewer.setMark method causes the mark selection changed event to be generated. This only seems to be used by incremental search and for marked regions used in Emacs style editing.

Where is the live templates for Java in Intellij-IDEA?

I could not find the live templates for Java! Who can tell me how to set? Thanks.
They're inside all the nodes that are not specific to another language than Java: iterations, output, plain, surround, etc.
As JB Nizet wrote there is not a special node for Java (but you can create one). If you want your own Live Template for Java created do the following.
Open Settings window (File -> Settings)
Click on Editor -> Live Templates
Choose Template Group in which you want to add your Live Template
(you can create your own Template Group if you wish)
Click on + icon and choose Live Template
Specify the Abbreviation, Description and Template text.
Do not forget to define the context (in your case Java)
Example
Here is an example of how to create your own TODO text
Open the Setting window with Live Templates editor (as specified above).
Click on + icon and select Template Group.
Name this group Java.
Click on + icon again and select Live Template.
Specify your Live Template and DEFINE CONTEXT.
In my case writing mtodo and pressing enter will result in:
// TODO myName
You can even use variables. Write in your Template text e.g. $DATE$ and $TIME$
// TODO myName $DATE$ $TIME$
Click on Edit variables button and assign to each variable (defined by dollar sign) and expression (predefined function).
Now mtodo will result in
// TODO myName 13.10.2015 15:39
Predefined functions could be found here. The example was created using IntelliJ IDEA 15 EAP.
For those of you who have taken Postfix completion for Live templates, it is worth mentioning they are different. from not-choosing pretty good answers from #JB Niznet and #vitfo, I guess that's the case for OP writer. The document, here, says:
Postfix code completion is similar to live templates, it transforms the current expression without selecting it. For example, you can type .if after an expression to invoke the corresponding postfix completion and wrap the expression with an if statement.
You can check out a list of postfix completions:
Open the Preferences window
Click on Editor -> General -> Postfix completion
By default, there is no JAVA group in this setting page.
However, these default settings distribute on each feature group. For example, iterations:
IntelliJ IDEA 2019.2.4 (Ultimate Edition)

In Enterprise Architect, can I export the structured specification of an element's scenario into a report?

For each model element, there is the option in EA 10 to create internal requirements, constraints and scenarios. All of them end up in reports if you use the pre-defined Basic Template.
However, if you select "structured specification" instead of the default "description" text field for a scenario, then I end up with the steps of the structured specification being ignored in the report output.
How can I have them included in reports?
It sounds like you need to create your own reporting template. This may seem a bit daunting first time out and the template editor is pretty ornery, but luckily you can use an existing template as a starting point.
Hit F8 to bring up the Generate Documentation dialog, then select the Templates tab. Click New, specify a name and select a template you like to be copied. Don't bother with a template group, and leave the fragment checkbox unchecked.
In the editor, scroll down about halfway (assuming you selected to copy the Basic template) and locate the yellow scenario > tag.
Now in the checkbox tree on the left, scroll down do Package - Element - Scenario. Note that Scenario is checked, but Structured Scenarios is not. Check it.
In the editor, note the new structured scenarios > tag. Remove the right-click-to-insert text, then right-click and select Insert Field, then State etc.
It's more than a little fiddly, but if the Basic template is good enough to begin with you should be able to add the structured scenarios with a minimum of effort.
For more information, see the help file under Reporting - RTF Documents. Note that the individual fields aren't listed in the help file, you need to open up the template editor to see what specific information you can extract to your report.