Roslyn Code Diagnostic report other than text? - roslyn

Is it possible for a Diagnostic to return something other than simple text.
For example colourised text, or images? Or insert a Glyph in to the Editor Text

Currently, there is no support for this. Diagnostics need to be able to be displayed in multiple places: not only the editor but error lists, command line builds, build server builds, etc. Restricting it to text ensures we can get the diagnostic everywhere it needs to be.

Related

Auto Formatting statements in VS Code

I am new to VS Code coming from Visual Studio 2017 and I really miss the auto-formatting options there. Like:
Automatically format statement after I type a ;
Automatically format block when I type }
Automatically format braces when they are automatically completed
My question is that is there any way to get these on options on VS Code, such as some tweaks on the settings.json?
I assume the C++ extension is enabled. To check if it is, go to the extensions tab on the left, and at the top click the three dot button and click "Show Built-in Extensions." That's where the C++ extension would be.
And I assume you've already checked this out, but there is some additional info here in the docs about including a .clang-format file and the fallback option if you don't.
vscode-cpp-docs
In theory you should be able to format using the provided "editor.formatOnType" setting. If not, try installing the Clang-Format extension and see if that works.
Clang-Format

How to make Vim format C++ code automatically as I type

I have setup clang-format to reformat the current line/selection when I press Ctrl-K in Vim (see the official documentation how to do that). However, it's annoying to be constantly pressing Ctrl-K whenever I edit a line.
Is there a way to make Vim call clang-format as I type or edit code automatically, without me having to press Ctrl-K? In other words, probably after each key stroke in insert mode?
I haven't seen anybody setup vim this way --- what are the potential problems with this setup?

How to fix indentation in Systemverilog source

I am using systemverilog very often.
I am using UltraEdit as text editor. I use also VIM.
Sometimes I have to copy code from some other places and paste it into my code.
It may not be indented properly. It is a difficult task to indent it properly again.
Can anybody suggest any method or tool to do it easily?
Method
Visit EDA Playground
Paste your code into one of the editor windows
Select all text with CTRL-A
Reindent all text with SHIFT-TAB
Some backgroud
There is a Verilog mode for Code Mirror which supports SystemVerilog. CodeMirror is an in-browser text editor written in JavaScript which is used on a number of websites, including EDA Playground.
You could also paste and reindent in the example window here, or you could download it yourself and run it locally.
The verilog mode in Emacs supports indentation, so you can open your file in Emacs (from the command line, run emacs file-name.v, select all by pressing Ctrl+H, then reindent by pressing TAB and save with Ctrl+S.
UltraEdit has command ReIndent Selection at bottom of menu Format.
All lines of a selection of any type of text file can be re-indented (not reformatted, i.e. not inserting line breaks or removing line breaks) with this command as long as
the file is syntax highlighted based on a wordfile (*.uew) suitable for type of text file,
the syntax highlighting wordfile contains appropriate indent/unindent string definitions.
Therefore it is no problem to re-indent code after paste by selecting pasted block and use the command ReIndent Selection with a good syntax highlighting wordfile for SystemVerilog.
The syntax highlighting wordfile currently used for active file can be opened for editing or improvement by clicking on button Open left of language list box preselected according to used syntax highlighting for active file at Advanced - Setttings or Configuration - Editor Display - Syntax Highlighting.
The lines of interest in the wordfile regarding indent/unindent start with
/Indent Strings =
/Unindent Strings =
/Ignore Strings SOL =
More information about those three lines can be found
in help of UltraEdit on page Syntax Highlighting,
in online help on page about wordfiles, and
in user forum topic template for syntax highlighting language wordfile.
A user contributed syntax highlighting wordfile for SystemVerilog can be downloaded from wordfiles page.
Note: As command ReIndent Selection is a basic command for all languages, it is not as smart as tools written to re-indent or even reformat source files written for specific languages with true language intellisense like Artistic Style for C / C++ / C# and Java (also supported built-in by UE).

How do I turn off auto-formatting in VS2013 for C++?

VS2013 has added auto-formatting for C++. My personal opinion on auto-formatting is that it's ultimately harmful for developers but I have to accept not everyone agrees. What bugs me is that I can't seem to disable auto-formatting completely. I have unchecked every checkbox under Tools->Text Editor->C/C++->Formatting->General yet when I type:
void f ()
VS2013 replaces this with
void f()
That's not the code-standard in this specific project which means I have to go back and insert a space. There are other examples where I have to fight against VS.
I don't want to change the spacing settings because
I work in multiple projects with different code standards
I don't believe in auto-formatting so I just want it to get out of my way
I just want VS to not modify my code automatically.
PS. I am not against that VS can format code but I want to invoke that manually
You can turn off automatic C / C++ /C# code formatting by going to the Options dialog from the Tools menu, selecting the Text Editor → C / C++ / C# → Formatting → General page, and unchecking all the boxes there. You'll still be able to manually format when all of the auto-formatting settings are turned off.
I know this isn't exactly the answer you're looking for, but you can preserver that void f () formatting if you go to Tools > Options > Text Editor > C/C++ > Formatting > Spacing and under Spacing for function parantheses you check the option Insert space between function names and opening parentheses of argument list.
I also had this problem and unchecking all the checkboxes in the formatting options did not help.
It turned out that this was caused by an option in the plugin “Visual Assist X” from Whole Tomato Software.
In my case this problem could be solved by going to “Visual Assist Options”-->”Corrections” and unchecking the Checkbox “Format after paste”.
It's a bug in VS 2013 beta that it cannot be turned off completely, see issue submitted by FuleSnabel: http://connect.microsoft.com/VisualStudio/feedback/details/797716/turning-off-auto-formatting-for-vs2013-c-only-seems-to-partial-disable-auto-formatting.
Some possible workarounds:
If you just peek into some projects which have different/weird style: if an unwanted auto-formatting happens, then you can perform one undo step, this should undo only the auto formatting part of the operation and not your contribution. Fortunately these two (or sometimes more auto formatting steps) are not grouped together into one command probably for this exact reason: you can go back and override it. It is annoying though if that happens all the time. You can configure the behavior to match your style, but you say you have project with different code styles.
Tools/Import and Export Settings... - you can export the specific settings for a certain project and then import it later. This will save .vssettings XML format file. If it's about just a specific file type, than it can be just a few kilobytes long. Unfortunately this requires manual steps. The best would be if these settings could be overridden from the solution configuration file or even the project configuration file, could be part of them.
Note, that this second point is problematic if you really work parallel in your projects with simultaneously open Visual Studios. In this case that settings will be saved finally what the last closed VS instance had I think.
Having different auto formatting saved for solutions can be a feature request for next release (certainly not make it to VS 2013). What I usually come across is the tab/space indentation behavior differences, it's the most common difference in project styles. Indentation also can be configured individually for most file types, but as as in your case, projects can differ, and then it becomes annoying.
Just remember that resharper can also override the indentation/formatting settings. You can turn that off by doing this
ReSharper -> Options -> Environment -> Editor -> Editor Behaviour -> Auto-format on closing brace (un-check this).
To turn off automatic brace completion, go to:
Tools > Options > Text Editor > All Languages > General > Automatic brace completion
...then uncheck "Automatic brace completion".
Go to:
Tools->Options->Text Editor->C/C++->Formatting->Spacing
Then deselect or select the boxes that pertain to the code type you are writing.

Eclipse copy code with syntax highlighting

I'm writing a document of programming guidelines for my developers team. I use MS Word. We work with Eclipse CDT (C++). I need to copy-paste C++ code with syntax highlighting from Eclipse to Word. I've tried Notepad++ and it can export text with syntax highlighting, but it's highlighting is limited to basic syntax (it doesn't know about defined class, enum etc...).
Eclipse syntax highlighting is very powerful and I wish to export directly from Eclipse to Word using it's syntax highlighting.
Is there any Eclipse plugin that achieve this purpose? Or some trick to do it (without taking a screen snapshot)?
When you copy the code to word document, you can choose the option "keep source formatting" and the highlighting will be the same as the one in eclipse.
EDIT:
As mentioned in the comments below, this won't work on folded code, so you can right click on the line numbers and select Folding > Expand All
EDIT 2:
Also mentioned in the comments, as of eclipse oxygen, the code is automatically copied with syntax highlighting
When I copy from Eclipse straight to PowerPoint some of the formatting is messed up. Bold and color seems to "keep going". But if I copy from Eclipse to Word -- and then from Word to PowerPoint (with the keep source formatting CNTRL-K) -- the formatting is correct. I recently upgraded Eclipse to Mars and Office to 2013. I still have to go through Word first.
I was trying it too and for some reason not every compile unit would keep the formating.
After a while I've seen that you also won't get the formating kept if there are parts of the code hidden, so for the ones that cannot make it work with the answers above, just make sure that there are no "+" signs on the left of your code (mine were where the imports at the beggining).
Copying of formatting is supported since version 3.2
Note that everything is copied: highlighting of spelling errors, marked variables/types/etc and underscoring of warnings/errors.
To avoid that, turn off spell checking, "Mark Occurrences" and "Report problems as you type" respectively.