I'm trying to get MonoDevelop-Unity to behave more like Visual Studio. I have compiled a list of issues regarding this.
1) Errors are never automatically shown on the Error Pane at the bottom of the main window. I have to tab to Unity to see them.
2) The document is never automatically formatted in real-time when typing. I would like the line to be properly spaced when appending it with a ';', the same goes for '}'.
I have played around with Tools -> Options -> Text Editor -> Indentation and Source Code settings but to no avail.
3) When hitting run I have to go into Unity and hit run rather than Unity being run automatically
Can anyone please tell me how these issues can be resolved?
Related
Context
I use this command with the shortcut Ctrl + T (alternatively Ctrl + ,) to quickly navigate to files in my solution (WPF app if relevant). As I do not remember the exact file names I would (until recently) use the suggestions that were showing below the prompt to find my files as in this example:
Navigation with suggestions
Source of example
Since I last started VS I get none:
Navigation without suggestions
Attempts
Restarting and updating visual studio didn't help. Neither did deleting the .vs file of the solution. I also toggled the statement completion fields in Tools > Options > Text Editor > All Languages, saw no change.
I believe this might be some Intellisense error but I am not sure. I would be thankful for any guidance or information.
One possible cause is somehow you had collapsed the list. If you hover over the point in the picture below you should get a resize handle. Grab it and pull it down to get your list back.
I am using VS17 to edit client side Javascript files.
The built-in intellisense and linter are great, but when the linter finds an error I get only a green scribble line under the error (using dark theme).
This is way too easy to miss. I end up going back to the browser etc. only to find out a syntax error way too often.
How can I get more visual cues on linter errors. I want something on the left side, something marking the whole line from end to right (as in sublime-linter), or something else that makes it super visible that something is wrong.
To visualize errors list to left side of your VS window more highlight follow these steps:
Go to left bottom side of VS and drag Error List. And Drop it in center pane icon
After this you can easily view all errors and warnings to left pane.
Edit:
Move Error List to left side of you window and then a new prediction will show up like: and drop it to center .
Not drop to middle center of your editor!
EDIT 2: For highlighting the error code lines in your editor, you need two add-in to be enabled:
Enable Productivity Power Tools will highlight errors code-files (tab).
Enable ReSharper will highlight error lines in a code-file.
EDIT 3:
After installing Productivity Power Tools then go in VS solution explorer and select errors from dropdown:
And follow this reference.
Have you tried changing the "Compiler Error / Other Error / Syntax Error / Warning" colors?
As a slight aside from the obvious requirements to see the actual error messages, Visual Studio (certainly from 2013 onward) has an excellent feature that highlights markers in the code on the scroll bar to the right; I use it all the time as a fast navigation method - it's called the 'Enhanced Scrollbar' (a simple and effective naming convention!).
This link shows the latest version, but, being a lowly public sector developer, I use VS2013, which looks like this...
It's a little difficult to see, but notice at the bottom of the section that I'm working on there's a simple error in the code, where I've put a space in a property name (d'oh!). The bar to the right looks like a miniature version of the code, showing different coloured blocks beside what you've written. Notice that there are yellow and green blocks, showing changes to the code, magenta blocks, showing questionable spelling, and, just where you can see the white bar across the width of the miniature view, there's a red box, indicating the error in your code. This arcticle goes a little more into it.
To activate this in 2017, use the link above. For 2013, go into Tools > Options. In the search box at the top of the dialog type 'scroll bar' and make sure the highlighted areas in the screenshot below are checked or unchecked as required.
Fantastic feature - I recommend it!
I'm using Visual Studio 2015 (14.0.x - update 3) and no matter what I try, I can't get All Languages to do Smart indenting. I go into Tools -> Options -> Text Editor -> All Languages -> Tabs and set it like so:
I've got a handler file open in VS (.ashx file) with inline code:
Notice that when I position my cursor right after the opening curly brace and hit Enter, the cursor goes to the next line, but indents too far over. This does not happen when a c# file is being edited. When I go back into Options to see what is going on, I am surprised to find Smart formatting cleared:
It doesn't matter how many times I re-select Smart, it doesn't honor it, and it clears it again. I don't believe ASHX file types have their own registered Text Editor type in VS, but maybe it does, listed under something unexpected, and that is overwriting it. I can't see any types that even resemble 'handler', or etc.
I even tried hand-editing the .vssettings file to enable Smart, but it still doesn't work, and Smart is cleared again when I go into Options.
I have read this post and tried to follow it, but my case is a little different.
How can I get the same indent behavior on my ASHX file as I get with .cs files, so that when hitting Enter after a line, it goes to the correct place on the next line, as expected?
Smart indenting is not applicable for all languages and hence the check is disappeared for All Languages, but the option is checked for C# ,html etc. for any applicable language.
Please refer to this link: https://learn.microsoft.com/en-us/visualstudio/ide/reference/options-text-editor-all-languages-tabs?view=vs-2015
I have been assigned to a project at work and I need to do some old-style debug because the Debug itself doesn't work with the libraries which are being used.
So, since it's a C++ with Qt application, I first tried with qDebug(). Then with cout, and finally with printf (which I hate in comparision to the former ones). NOTHING.
Nothing is written into the output window of Visual Studio 2008, and I'm quite sure it is executing these lines of code (I even tried to put a qDebug at the very beginning of the main.cpp). It is a GUI app by the way, and I've tried Debug output as well as Build output, but nothing is displayed.
I have looked for similar questions, but none of them provided a solution yet. Any help?
Chances are, your Visual Studio environment has been configured to redirect all output from the Output Window to the Immediate Window. I've been bitten by this a couple of times, as this is inexplicably a default setting for certain environment configurations.
To reset the setting, follow these steps:
From the "Tools" menu, select "Options".
Expand the "Debugging" item in the tree to the left, and select "General".
In the list to the right, scroll down to "Redirect all Output Window text to the Immediate Window", and ensure that it is unchecked.
Click OK to return sanity to the world.
It looks like you can't use qDebug directly if it is not a console based application. Sounds weird to me, but sadly it is like that.
Update: Since I see this is one of my most looked at questions, now a few years later I should point out what I found to be the most common cause of this problem: bad syntax elsewhere in your code. 100% of the time I've had this happen, it was because I'd forgotten a curly brace for another block of code, or I had a dangling if, or an earlier line of code I didn't finish. Check for IDE errors first for something like ") or } expected"
Original Question:
I feel like this is an all time dumb question to ask, but I have no idea how to fix this and google is turning up nothing.
In visual studio, when I type:
try {
}
VS would automatically reformat it to
try
{
}
But now it's just leaving it at the first one. I assume I accidentally hit a hotkey or something. Help me fix this please?
Tools->Options
Click Text Editor -> Whatever language -> Formatting
Tools->Options->Text Editor->C# (or whatever language)->Formatting->New Lines
Select the options you want.
If you have Power Commands installed you can then go to the Tools->Options->Power Commands and make sure "Format Document on Save" is selected.
Whenever you save the edited file the Curly Braces will be auto aligned.
In addition to the default Visual Studio settings mentioned, for ReSharper users, this is configured via:
ReSharper [menu] -> Options
In the Options dialog, navigate to Environment -> Editor -> Editor Behavior -> "Auto-format on closing brace". See image:
9 times out of 10 this problem is caused by bad code elsewhere on my document. Either I'm missing a ; on a line, or perhaps a closing }. Visual Studio is unable to figure out what I'm trying to write in code and thus it's unable to format. Check for compiler errors, fix them, and then press Ctrl+K then Ctrl + D to make Visual Studio reformat the current document (your hotkeys may vary, depending on the version of Visual Studio and your settings).