Cloud9 has a command under Tools called "Strip Trailing Space". I want to automatically run this command before every time I save a file, so I can be sure my files never contain trailing spaces. How is that done?
After frustratedly Googling for quite a while, I can find no documentation on how to achieve stuff like this. They claim Cloud9 is the most hackable IDE in the world though, so it ought to be possible.
Well this is embarrassing, but I combed through the preferences again and found the option On Save, Strip Whitespace under Cloud9 -> Preferences -> Code Editor (Ace).
As of July 2015 it is under Cloud9 > "Open your Project Settings" in the top menu bar.
"general": {
"#stripws": false
},
AWS Cloud9 has changed the option On Save, Strip Whitespace location to under Cloud9 -> Preferences -> Project Settings -> Code Editor (Ace)
Related
I'm trying to change the default path of the integrated terminal in Visual Studio Code, but I'm not sure how to. I do know how to change it in the windows command prompt, but not in Visual Studio Code. I looked in user settings, but I can't find anything there to change.
The current default path is C:\Users\User_Name.
I'd like to change it to C:\Project.
How do I do this in Visual Studio Code?
Short answer
Edit the user preference "terminal.integrated.cwd": "" to the path that you want the integrated terminal to open to.
Long answer
The same answer, but the long step-by-step version,
In Visual Studio Code go to:
Menu File → Preferences → Settings
Now that you are in the "User Settings", using the "Search Settings" bar across the top of the window paste or type this:
terminal.integrated.cwd
It will list the following as a result:
// An explicit start path where the terminal will be launched, this is used
as the current working directory (cwd) for the shell process. This may be
particularly useful in workspace settings if the root directory is not a
convenient cwd.
"terminal.integrated.cwd": "",
You will notice that it will not let you type here to change this setting. That is because you can't change the default setting. You instead need to change your personal settings. Here's how...
Click the pencil icon to the left of the this option and then the "Copy to Settings" option that pops-up.
You should have a split screen in which the right side of the screen has the heading Place your settings here to overwrite the Default Settings. This is the correct place for you to make changes. You might already have a few personalized settings listed here.
When you clicked "Copy to Settings" it automatically added this line for you:
"terminal.integrated.cwd": ""
Notice that whichever item is last in this list will not have a trailing comma but any items before it in the list will require one.
FYI: you could have simply typed or copy/pasted this into the personalized settings yourself, but following these steps is the process to learn for changing other preferences as needed.
Now you are able to type to set the path you want to use. Make sure to use \\ in place of \ and you do not need the trailing \. For example including this line would always start your terminal in the baz directory:
{
"terminal.integrated.cwd": "C:\\Users\\foo\\bar\\baz"
}
To apply the change, simply Save and restart Visual Studio Code.
As others have already explained, you can add a setting to change the default folder for your integrated terminal to start in. This setting also accepts Visual Studio Code variables, so to make a relative path from the root folder of your workspace you can use ${workspaceFolder}.
For example, for your terminal to always start in the subfolder mystart, your setting would be:
"terminal.integrated.cwd": "${workspaceFolder}/mystart"
Thanks for the original answer from Peter. Definitely helped !
It has now slightly changed in more recent versions of VS Code.
Navigate to File -> Preferences -> Settings
Type cwd in search
Choose Terminal > Integrated: Cwd settings
Type the default path you want to set in the text block below (simply, no need for double hashes to escape)
No need for saving, It's automatic
Restart VS Code
terminal cwd screen
Try this option in the "Intergrated Terminal" section of Settings.
"terminal.integrated.cwd": "",
You can also set it to a relative path to the open folder with
"terminal.integrated.cwd": "./example"
So if you do menu File → Open Folder... → project, and open the terminal with your keyboard shortcut, it will open to ~/project/example automatically.
It can be a general folder like src you would always use, or a specific one (but then it would be best to save it in file .vscode/settings.json).
The below option will help you do this.
Menu File → Preferences → Settings.
Add or edit the below setting.
terminal.integrated.shell.windows": ""
From the next terminal it will be reflected.
And add file .profile to your default shell, and add the default path to it.
More information can be found
at Integrated Terminal.
I am trying to compare two branches on TFS and TFS is showing files which do not have any differences.
I tried taking latest and resolving conflicts but that did not help. I don't know what's the problem.
What else can I do to make it go away?
You probably need to turn off the option to trim whitespace, which can be found on the Compare Files toolbar:
You can also toggle Edit -> Advanced -> View Whitespace to see which ones are spaces vs. tabs, which on my machine has 3 separate keyboard mappings:
Ctrl+E, S
Ctrl+E, Ctrl+S
Ctrl+R, Ctrl+W
(You can remap this if you want by going to Tools -> Options -> Environment -> Keyboard.)
make doesn't like spaces for the body of a target in a Makefile. Has to be a tab.
I changed "editor.insertSpaces" to "auto", thinking this would help. It didn't.
I had to set it to false in order to get the code working.
This is now possible with Language Specific Settings.
https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings
To customize your editor by language, run the global command Preferences: Configure Language Specific Settings (command id: workbench.action.configureLanguageBasedSettings) from the Command Palette (⇧⌘P) which opens the language picker. Selecting the language you want, opens the Settings editor with the language entry where you can add applicable settings.
Once you have the editor open, enter the following configuration for [makefile]
{
"[makefile]": {
"editor.insertSpaces": false,
"editor.detectIndentation": false
}
}
VS Code does accurately guess the file type for a Makefile, but the language configuration does not specify tab style. There is an outstanding pull request that addresses this issue.
Before that PR lands, you may be able to fix this locally by editing the application itself. On OSX where applications are really just folders, you can find the language configuration for Makefiles in Visual Studio Code.app/Contents/Resources/app/extensions/make. Open up make.configuration.json and add "insertSpaces": false on line 2. That fixed it for me.
Visual Studio Code users that wish to use spaces as their indent character in the global configuration will have trouble editing Makefiles because it requires the user to use tabs as their indent character instead of spaces. Updating the configuration just to edit a few lines is not a viable solution IMO.
You can use the Command Palette (View > Command Palette) and type Convert Indentation to Tabs and hit Enter. You editor should now have updated all indentation to their corresponding tabs equivalent.
I started playing around with javascript on Visual Studio 2013 and I couldn't figure out why it is not automatically positioning the cursor to the correct indentation level, instead always resetting back to the head. For example:
function foo(y) {
var f = function bar(x) {
|<-- cursor should be here, but ends up
|<-- over here
}
Does anyone else see this and how do you change it?
I have the typescript, nodejs plugin installed and that's about it.
With a bit of research, things started working for me. First check that, Tools -> Options -> Text Editor -> Javascript -> Tabs -> Indenting is set to 'Smart'. Next restart VS. For me restarting was important since, apparently, my file had some mixed line-endings and that was throwing off the indentation engine. Hope this helps someone.
In my case, the whole javascript formatting stopped working for every file, I could play with language options and restart VS, nothing helped, until I unchecked:
Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service -> Enable the new JavaScript language service
The editor returned to old school javascript formatting, which is sufficient for me.
I'm not sure if this applies to Visual Studio 2013 (the original question), but in 2015 at least, you can select the text in your JavaScript file you want to format, right-click, and then choose "Format Selection". There's a keyboard short-cut as well (Ctrl-K, Ctrl-F).
If you already have Tools -> Options -> Text Editor -> Javascript -> Tabs -> Indenting set to 'Smart', then try setting this option (the Indenting setting) to 'None' and click OK.
Open the Options back up and, set Tools -> Options -> Text Editor -> Javascript -> Tabs -> Indenting back to 'Smart', click OK.
Close and reopen the file you were working on.
In Aptana 2 there was this tidy thing or something like that that you could setup to remove empty whitespace from the ends of lines after saving. You could set it to preserve empty lines and so on. Can this be done in Aptana 3 because I'm not seeing that ability and if it is there I can't find it.
Check out AnyEdit for Eclipse at http://andrei.gmxhome.de/anyedit/
It does what you are looking for and adds some nice conversion tools for characters and spaces.
I use it for web stuff (with Aptana), Android and App Engine. Works great with all of them.
When installing from the URL on that site, just select your Eclipse version and pick AnyEditTools.
There is a JIRA ticket currently filed against it: http://jira.appcelerator.org/browse/APSTUD-814. You could watch the ticket for progress or add your voice there.
Turns out this was implemented in Aptana Studio 3 in 2012, go to Preferences -> Aptana Studio -> Editors
and in there enable Remove trailing whitespace characters. Then when you save a file you should see the whitespace disappear.