Is there a way (or tool) to stop Visual Studio text editor (2015 or 2017) from auto moving the comment lines when pressing Ctrl+K,D or relevant key stroke (Ctrl+E,D - format entire document) ?
I would like my comments to stay at the position placed, regardless of the code position above or below.
For example, when writing a comment line starting say at col 80 as
code line
|-------- white space -------------------| //... comment ..
code line
so that it doesn't interfere with the code below or above, when pressing Ctrl+K,D the comment is shifted left to align with the surrounding code.
On the other hand, when a comment is placed following a code line, as below
|----code line ------|-- white space --| //.... 1st comment line ....
|-------white space ---------------------| //.... 2nd comment line....
an eventual 2nd comment line remains aligned with the above one, which indicates that the editor can adjust the position of comment lines based on certain criteria
Edit: I should clarify that I would like to preserve the rest of the functionality of Ctrl+K,D
Related
I am using the Scintilla .NET text editor control (ScintillaNet.dll) to display SQL. I am using the following command to position the caret cursor at a given line number. In the example below, I am positioning the caret cursor at line 102 (0 based. The grid displays 1-based line numbers.)
scintilla1.GoTo.Line(102); //0 based
I'd like text in the viewport to be displayed at the top of the screen as shown below, as the first visible line
How can I identify how to do this?
Update
This looked promising:
scintilla1.Lines.FirstVisible.Number = targetLineNumber;
but after executing, scintilla1.Lines.FirstVisible.Number wasn't always equal to targetLineNumber and I don't know what is interfering with it.There are hundreds of lines following the targetLineNumber line.
Get/Set first visible line works for me https://www.scintilla.org/ScintillaDoc.html#SCI_SETFIRSTVISIBLELINE
You can keep the cursor position first (SCI_GOTOPOS) and then set the first visible line
By default, a TextBox has a vertical blinking cursor/caret. By default, these cursors in text fields on this site (and most sites) are probably too.
If I want a non-blinking horizontal line (looking like a underscore _ ), would that be possible?
I've read topics about editing the default vertical one to be colorful and even replaced with a image...but haven't come across a horizontal request.
I have played with the properties to make the vertical line almost look like a dot (gradient color choices). However, that seemed incredibly excessive just to (somehow) get a horizontal line.
This is my expectation:
Enter your text here __
This is text that has been entered, notice how the cursor/caret is still leading __
This is what I have currently:
Enter your text here, the cursor is blinking |
This is text that has been entered, look at the boring cursor/caret leading us |
Is being excessive the only way?
For reference, this is what I played around with excessively: Code Project - Customizing the Caret of a WPF TextBox
Using Visual Studio 2013 & 2013, if that makes any difference.
In Visual Studio 2010, I have multiple lines of text to be commented:
A
B
C
Using CTRL+E+C to comment out multiple lines, I get
//A
//B
//C
I would like to have a space (or indent) between // and A, hence // A instead of //A.
However, after I group tab a block of text and indent it, CTRL+E+C no longer comments out the selected text.
How to group comment and get the following:
// A
// B
// C
Pressing Ctrl+K+C or Ctrl+E+C After selecting the lines you want to comment will not give space after slashes. you can use multiline select to provide space as suggested by Habib
Perhaps, you can use /* before the lines you want to comment and after */ in that case you might not need to provide spaces.
/*
First Line to Comment
Second Line to Comment
Third Line to Comment
*/
One way to do it would be:
Select the text, Press CTRL + K, C to comment (CTRL+E+C )
Move the cursor to the first line after the delimiter // and before the Code text.
Press Alt + Shift and use arrow keys to make selection. (Remember to make line selection(using down, up arrow keys), not the text selection - See Box Selection and Multi line editing)
Once the selection is done, press space bar to enter a single space.
Notice the vertical blue line in the below image( that will appear once the selection is made, then you can insert any number of characters in between them)
I couldn't find a direct way to do that. The interesting thing is that it is mentioned in the C# Coding Conventions (C# Programming Guide) under Commenting Conventions.
Insert one space between the comment delimiter (//) and the comment
text
But the default implementation of commenting in visual studio doesn't insert any space
I was able to achieve the desired result by using Alt + Shift + up/down and then typing the desired comment characters and additional character.
You can customize every short cut operation according to your habbit.
Just go to Tools > Options > Environment > Keyboard > Find the action you want to set key board short-cut and change according to keyboard habbit.
Might just be for Visual Studio '15, if you right-click on source code, there's an option for insert comment
This puts summary tags around your comment section, but it does give the indentation that you want.
I have Crystal Report in VS 2008. The report has group header section above the detail section and group like display in image below:
I have drawn vertical image in detail section but it displays like in following Image:
I also tried to scratched vertical line below the detail section but it in output line goes out of the box like in following Image
How can i solve this issue?
In VS2008 open this report. Select the line and go to Properties Window. There you can reduce the value of Bottom. So your line height will be reduced. Reduce the value of Bottom until the vertical line fits the horizontal line.
Hope this helps you, Leave comments if any !
in the report designer you should zoom the Section3, Details and resize the vertical line to end exactly when it reaches the horizontal line. I know it's a pain and in Crystal is not as friendly as it is in other reports designers (like in my favourite one DevExpress XtraReports) but still you can do it if you zoom and carefully handle the size of the line object.
After certain R#-recommended edits R# colors the background of blocks of code in a light royal blue and also places a mark next to the scroll bar with the same color. It is not an error or even a suggestion. It seems to be a temporary flag that clears if you close and reopen a file.
Steps to recreate:
Write a line of code like: string str = string.Format("{0}", 1);
Notice that R# will mark the str var with a light gray because it is never used.
Press Alt+Enter on the variable and select Remove Declaration from the R# context menu
See the line of code turn light royal blue...
Hover your cursor over the scroll bar marker, all you see is the code...
Does anyone know the meaning/usefulness of this "flagging"?
EDIT: My Resharper version is 4.5 running in VS 2005
I've verified the behavior that you're seeing in R# 4.5 VS 2008 (build 4.5.1274.1). I've gone through the ReSharper specifc colors in Tools->Options->Environment->Fonts and Colors and found this to be "ReSharper Highlight". I searched the ReSharper defect tracking for "remove declaration" and found this report:
RSRP-68435
A "remove declaration" fix appears for
the declaration of test. Selecting
this removes the declaration, but ends
up coloring the then and else clauses
of the if statement blue and adds blue
bars to the error strip.
The Jetbrain's answer is:
This fix works as designed. Removing
declaration can break code, so all
broken usages highlighted and you can
navigate them and fix or remove code.
Only simple expressions are removed
automatically (strings, numbers).