Setting a string property to \n in the settings designer - visual-studio

In the visual studio settings designer, how can a setting with string type be set to the newline character? Entering \n results in the string being set to literally \n - the escape sequence doesn't seem to have meaning in the setting seditor. So how do I set a setting's value to a non-printable character?
The settings designer edits the App.config (xml) file and the Settings.settings file. I thought about editing the App.config file directly, but entering \n there again sets the string to literally \n.

Click the down arrow in the Default value edit box. To get this (note the gray text):

There will be a designer file that goes with your form — either formname.designer.cs or formname.designer.vb, depending on which language you use. You'll have to edit this file to include your newline.
This is one of the few cases where I ever recommend touching this file. Most of the time it should be left alone, and your alteration placed in your form's constructor, InitializeComponent() method, or an event line OnLoad or OnActivate.

Related

Sublime Text Double Click highlighting modification

Sublime Text does not register a sass variable ($variable) as a single item when highlighting, so when I double click on the name, it highlights the word, but does not include the $-symbol in the highlighting. Visual Studio, on the other hand, selects the $-symbol along with the variable name when double clicking on a variable to select it.
I write sass all day long, and it could make my life drastically easier if I could modify this small behavior. Is there a way to change this? I am sure it would be possible with a plugin, but I don't know if one exists or how to find it.
There is a setting named word_separators which provides a list of characters that are assumed to not be part of a word for the purposes of things like double click selection, navigating by words, and so on.
The default for that particular setting is set to the following, which includes the $ character that is causing you woes:
// Characters that are considered to separate words
"word_separators": "./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~?",
You can modify this setting to not include the $ character so that it's treated as a part of the identifier, which should do what you want.
In order to ensure that you don't experience any other knock-on effects of this, you may want to set the setting in the preferences specific to the Sass syntax.
To do that, you can select Preferences > Settings - Syntax Specific while you have a Sass file open and focused, and then copy the default setting into those settings and remove the $ character.

soft tabs showing up as hard tabs, spaces converted to hard tabs

I have soft tabs enabled, but not only is the editor putting actual tabs in instead of spaces, if I type [space][space], it converts it to a tab. I've read that the editor tries to read existing files to guess your settings (I have Autodetect turned off if that matters), so I tried with a new file. Here is the relevant section of my settings file (which I edited through the GUI):
"ace": {
"#guessTabSize": false,
"#newLineMode": "unix",
"#tabSize": 2,
"#useSoftTabs": true
},
When I turn off soft tabs, it stops converting spaces into tabs, but either way, when I hit enter at the end of a line, autoindent uses a tab instead of spaces.
Cloud9 doesn't have any code that can convert two spaces into a tab.
When soft tabs is enabled it moves cursor as if two spaces is a tab, but that doesn't change characters in the file.
Enter at the end of line copies indentation from that line, and doesn't depend on tab settings.

Visual Studio 2010: While debugging, how can I copy string values containing carriage returns out of variables?

When I am stepping through code in c# (not sure if it's an issue in VB.NET) and looking at SQL stored in a string variable, sometimes I like to copy it and paste it into Notepad or my SQL program. If it contains carriage returns, though, it actually copies to my clipboard as line1\r\nline2. Is there a native method of copying this with actual carriage returns rather than carriage return escape codes?
Edit: This also applies to tabs which show as \t. This is happening because my code is reading SQL from a text file and the text file contains carriage returns and tabs. The alternative is to 1) not have any carriage returns or tabs in the SQL (which makes for ugly SQL) or 2) strip them out when reading the SQL into my string variable. I am not really keen to those options just for the sake of simplifying the debugging process, though.
It depends where you copy the value from.
If you hover your mouse over the variable when debugging, or look in the Locals window, you should see a little magnifying glass symbol in the tooltip.
Clicking this will open the Text Visualiser which should take account of any linebreaks.
For example, if my code is:
string test = "hello" + Environment.NewLine + "world";
Then I can look in Locals (notice it still shows \r\n there) or hover over test to see:
This opens the Text Visualiser from where you can copy/paste:
Put a breakpoint on the statment which has the variable (whole value you want to copy). As the control comes on the statement, move your mouse-pointer on the variable name. You will see a balloon box showing the variable name, a binocular icon and the value of the variable. Click on the binocular icon or the small down-arrow icon beside the binocular icon to view in it in text visualizer. Hope this is what you are looking at. This is in context with C# and hopefully its the same in VB.NET (but not sure).

Customizing Xcode [fonts, code sense, and more]

How can I make code completion case-sensitive?
How can I make Ctrl-k kill the content of the line and the new line character?
How can I make backspace always delete only one character, no matter what it is? Right now, it deletes spaces in chunks equal to my indent level.
How to change the indentation style in file templates? I like to have the opening brace on its own line.
How can I make the font aliased?
I'm using Xcode 3.2.2.
EDIT: Issues 2, 4, and 5 are solved. 1 and 3 are still open.
EDIT2: ad.3. Yes, I set Xcode to use spaces, not tabs.
3.
Look in Preferences : Key Bindings : Text Key Bindings : Indent Friendly Delete Backwards
If the delete key is mapped to this entry change it to plain Delete Backwards.
2.
In that same preference area, you can see that there is no delete line option to map ^k to.
How can I make code completion case-sensitive?
I don't think that's possible.
How can I make Ctrl-k kill the content of the line and the new line character?
I can't answer that one, you might need to write a script to do it.
How can I make backspace always delete only one character, no matter what it is? Right now, it deletes spaces in chunks equal to my indent level.
Backspace always deletes one character. It sounds like your file has tab characters in it, each one of which takes up the space of 4 spaces by default. You can tell Xcode to use spaces instead by de-selecting Tab key inserts tab, not spaces in the Indentation preference panel.
How to change the indentation style in file templates? I like to have the opening brace on its own line.
You need to create custom file templates. You can find the Xcode templates here:
/Developer/Library/Xcode/Templates/File Templates
You need to copy the appropriate templates to this location:
~/Library/Application Support/Developer/Shared/Xcode/File Templates
You can then edit the template files to use whatever indents you like.
How can I make the font aliased?
You need to use a font that has aliased characters. Try Monaco at 9 or 10 points.

Copy value of watch variable in visual studio without escape characters

Ok, this one has been driving me bonkers for ages and VS 2010 hasn't improved this. Say I have a variable like so
string szSql =
#"SELECT
Foo, Bar
FROM
Table
WHERE
Foo = Bar";
If I'm inspecting this in the debugger and choose "Copy Value" the value put into the clipboard has \r\n's in place of the carriage returns which is a bit of a pain. Is there a way to change this behaviour? (I know I can print it in the command window...)
Cheers,
Alex
Append ,nq (short for no quotes) to the variable name in the watch window and it will display the string without escape characters, which you could then copy. For reference the MSDN document is here.
Use the "text visualizer" popup on the value and copy it to the clipboard from there. It will be unescaped.
For lengthy text, such as a large xml document, I always use the immediate window. Just type this in and hit enter:
System.Diagnostics.Debug.WriteLine(szSql)
and it will spit out the text with line breaks and without escape characters. I then copy from the immediate window.

Resources