OmniSharp autocomplete for class names, not just methods/properties? - c#

I'm a bit new to C# and trying to get Unity/Mono working with Vim. I get OmniSharp autocomplete for methods/properties, but would like the autocomplete to pop up for class names.
For example, if I am in the middle of typing the following, I do not get a suggested autocomplete:
new Vect
Now if I hit <C-x><C-o>, I do get the correct OmniSharp autocomplete suggestions for this class.
Is there any way for OmniSharp to suggest classes rather than only methods and properties?
Thanks.

I assume you mean you want the autocomplete to happen when you don't have the '.' in the front and assume you are using YouCompleteMe plugin
Add this line to your .vimrc:
let g:ycm_semantic_triggers = {'cs' : ['.','re![_a-zA-z0-9]']}

Related

C# Localization Shortcuts

I don´t know how i should explain what i want to do.
In my Project are basicly 3 Sub-Projects.
First Project: Holds all Properties and Localizations.
Second Project is an Console Project, using the Properties from the First Project and some Localized Strings.
Third Project is an Windows Forms Project, using all Properties and Localized Strings from the First Project.
The Localization is working without trouble, i can start both Projects and when i change the Culture, it changes the Strings.
But: I have to Write the whole Path to the String everywhere.
Example:
Label.Text = Config.Localization.MyString
With the Settings, i can use an "Shortcut" by setting it to an new variable:
private Settings settings = Config.Properties.Settings.Default;
But with the Localization i cant to that to shorten it up.
Try´d the following:
private Type locals = CodepackConfig.Localization;
Label.Text = locals.MyString
Does somebody have hint for me how i can set a Variable to "Config.Localization"? And yes, i just code C# for 1 Month now, looks like a stupidly easy error :)
Check out the using directive's documentation.
I assume you're interested in something like
using Localization = Config.Properties.Localization;
1: https://msdn.microsoft.com/en-us/library/sf0df423.aspx?f=255&MSPPError=-2147217396

how to store "file://" in string format in c#

i want to store file:// as constant string to check is a particular String is URL.
public readonly String[] URLHEAD = { "http://", "https://","file://","\\\\" };
but but am not able to do it.
It's just the coloring indicating that it's a clickable link, exactly as if you start typing www after http://.
I wonder what made you think that you were unable to do something. You could compile and run your code anyway!
I highly suggest you try to pay more attention, as this "issue" was NOT really worth a question here.
Your code will work even if the color is blue. It is just an IDE setting as #Backs mentioned. But if you are really concerned with how it is marked up in your IDE then you can turn off the setting.
I'm assuming you are using Visual Studio.
Go to Tools\Options\Text Editor\C#\General\Enable single click URL navigation

C# Formatting in VS2015

My question is fairly simple:
Visual studio offers settings for formatting the code. However I was not able to fix this:
I want this
ReturnType FunctionName(){ .. }
instead of
ReturnType FunctionName() { .. }
So I want to get rid of the space between () and {}. Any suggestions will be greatly appreciated!
Thanks!
Tools -> Options -> Text Editor -> C#
Inside there you can find lots of ways to format your text. It is hard to say what you want from your post but anything formatting is a good start to look there.

Can't set DataDefinition.FormulaFields.Item.Text on C# (Crystal Reports 13)

I need to set a formula to dinamically change a bitmap path in a Crystal Report. I've been reading this could be achieved creating the formula in the Formula Field in CR and then modifying it through C# like this:
MyReport.DataDefinition.FormulaFields.Item("FormulaName").Text = "formula";
However, when I try to do it like this, the .Item attribute is nowhere to be found. I'm using CR 13 32-bit, already looked on SAP forums and no one knows anything. Do I have to do something else to get this to work??
I found the solution:
MyReport.DataDefinition.FormulaFields["FormulaName"].Text = "Formula";
The method was updated and was nowhere in documentation.
Add the reference CrystalDecisions.CrystalReports.Engine to your solution and then add the statement using CrystalDecisions.CrystalReports.Engine; to the code on your page.

Dictionary<string,List<service>> not allowed in staruml

I am using whitestaruml 5.4
with class diagram, i can't seem to be able to type this attribute
ServiceCategory: Dictionary<string,List<service>>
But Dictionary<string,List<service>> is a valid type for C#, how to get over this?
I suppose you are getting a lexical error on '<' as currently the input analyzer in WhiteStarUML does not accept embedded delimiters ( <[( style ) in the entity names to better handle matching opening/closing at lexer level. In the future this may get more sophisticated but currently the best way to skip parsing is to select the attribute in Model Explorer and fill the "Type" field in Property Inspector. As no parsing happens there it will be accepted. Just make sure not to modify the attribute in the Model View on the Diagram again.
It's June 2022 - still not fixed. Very disappointing.
When directly entering attributes, I just put a placeholder type (e.g., 'foo'). After which, you can go click on the attribute on the right pane and go down to the Editors / type field and replace it with what you want.
I use a lot of map<string,string> and have to do this often. If you try to directly edit a method and its arguments later, it will block you again and you'll have to repeat the procedure - but it can be done to make your diagrams correct. It's just a PITA.

Categories