Sometimes when I edit coffeescript files in Sublime text2 I got errors when compile it to js:
error: unexpected INDENT
$.post url,
In sublime text2 editor I see valid indents:
But if I copy paste this code in plain editor I see wrong indents:
click: ->
debugger;
# delete org here
$.post url,
debugger; string has wrong extra indent.
So how to edit coffeescript files in sublime text 2 with pleasure?
I got installed coffeescript package in sublime.
My Preferences.sublime-settings file is the following:
{
"auto_indent": true,
"auto_match_enabled": true,
"detect_indentation": true,
"draw_centered": false,
"font_size": 11.0,
"ignored_packages":
[
"Better CoffeeScript",
"Vintage"
],
"indent_guide_options":
[
"draw_active"
],
"indent_subsequent_lines": true,
"indent_to_bracket": true,
"smart_indent": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"use_tab_stops": true,
"word_wrap": "auto",
"wrap_width": 0
}
It looks like you are mixing tabs and spaces. Select View->Indentation and make sure that Indent Using Spaces is checked, then click Convert Indentation to Spaces and you should be all set.
Related
I was trying out the customizations from this post (
Change highlight text color in Visual Studio Code) but it broke my VS Code settings.json.
I followed the first answer, the highlighting now works.
But when I click on the top to bring up the "Menu Bar", I get the message:
Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.
{
"workbench.colorTheme": "One Monokai",
"security.workspace.trust.untrustedFiles": "open",
"files.autoSave": "afterDelay",
"editor.minimap.enabled": false,
"editor.wordWrap": "on",
"window.commandCenter": false,
"workbench.layoutControl.enabled": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.mouseWheelZoom": true,
"html.hover.references": false,
"css.hover.references": false,
"less.hover.references": false,
"scss.hover.references": false,
"window.menuBarVisibility": "compact",
"window.zoomLevel": 1,
"editor.tokenColorCustomizations": {
},
"workbench.colorCustomizations": {
"editor.selectionBackground": "#e788ff7c",
"editor.selectionHighlightBackground": "#ff00005b",
"editor.selectionHighlightBorder": "#fbf300e0", ##border when you select
"editor.findMatchBackground": "#f352fe8f",
"editor.findMatchHighlightBackground": "#8e52fe9e",
"editor.findMatchHighlightBorder": "#fbf300e0" ##border when you search for something
}
}
I'm not sure what should I do to fix this issue.
Comments should start with //, not with ##.
VS Code's settings.json follows JSON with Comments (jsonc) mode:
https://code.visualstudio.com/docs/languages/json#_json-with-comments
In addition to the default JSON mode following the JSON specification, VS Code also has a JSON with Comments (jsonc) mode. This mode is used for the VS Code configuration files such as settings.json, tasks.json, or launch.json. When in the JSON with Comments mode, you can use single line (//) as well as block comments (/* */) as used in JavaScript.
In addition, the editor should have shown you that something was wrong.
In vscode editor, I have typed the feature file line and vs code display the autosuggestion, once I choose from the autosuggestion, below line gets added in editor in following broken format, And I click on the ("|')[^\1]*\1 action link. Could someone please advise the issue here ?
Original feature file line is as follows; And I click on the "Add" action link
Below is my settings.json file;
{
"cucumberautocomplete.steps": [
"tests/cypress/integration/**/*.js",
"cypress/integration/**/*.js"
],
"cucumberautocomplete.customParameters": [
],
"cucumberautocomplete.onTypeFormat": true,
"cucumberautocomplete.formatConfOverride": {
},
"git.ignoreWindowsGit27Warning": true,
"cucumberautocomplete.pages": {},
"git.enableSmartCommit": true,
"git.confirmSync": false,
"git.autofetch": true,
"diffEditor.ignoreTrimWhitespace": false
}
Versions:
cypress-cucumber-preprocessor: "^2.5.5",
VS code : 1.65.2
Operating system: Ubuntu 20.04
I installed Svelte for VS Code. When I saved .svelte file all comments get deleted. This does not happen for .html, .js or .jsx files. I also use this Prettier plugin. Sometimes I just want to temporarily comment them. How do I disable this feature?
Below is the markup and vs-config
<div
on:mouseup={event => {
// console.log('This line gets deleted on save for .svelte file');
}} />
{
"workbench.colorTheme": "Default Light+",
"workbench.editor.enablePreviewFromQuickOpen": false,
"workbench.editor.enablePreview": false,
"prettier.singleQuote": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
},
"prettier.printWidth": 80,
"json.schemas": [
],
"editor.tabSize": 2
}
I would like to know if there is anyway to keep paste_as_text: true,
But keep the blank lines / new lines, when paste something to TinyMCE.
I´m uploading my code below. Already searched alot on web, and didn´t found any answer.
Thanks for anyone help.
Try to pase this text:
"this text you should
paste to the editor for testing"
-> You see, the blank line between the phrases, is not pasting
tinymce.init({
selector: '#mytextarea',
height: "calc(100vh - 90px)",
width: "100%",
plugins: "paste",
paste_as_text: true,
force_br_newlines: true,
force_p_newlines: false,
forced_root_block: 'div',
setup: function (editor) {
editor.on('init', function (e) {
editor.setContent('');
editor.getBody().style.fontSize = '13px';
editor.getBody().style.fontFamily = 'Arial';
});
Using the Python extension, with yapf - nothing happens when I hit format:
VSCode Version: 1.0.0
OS Version: OSX 10.11.4
My workspace settings:
// Place your settings in this file to overwrite the default settings
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/js-build": true
},
"editor.scrollBeyondLastLine": false,
"python.pythonPath": "/Users/joshma/.envs/venv/bin/python",
"python.linting.flake8Path": "/Users/joshma/.envs/venv/bin/flake8",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"editor.formatOnType": true,
"python.formatting.provider": "yapf",
"python.formatting.yapfPath": "/Users/joshma/.envs/venv/bin/yapf"
}
The steps I took:
Rewrite a function call to foo('a' )
Verify that running cat path/to/file.py | yapf formats that line to be foo('a')
Select entire file, cmd + shift + p, Format Code.
Nothing happens :(
It's possible I don't have some path/configuration set up correctly - is there some way to debug this?
I think you are missing this option,
python.formatting.formatOnSave
This is my configuration and the formatting is working,
"python.formatting.formatOnSave": true,
"python.formatting.provider": "yapf",
"python.formatting.yapfPath": "/usr/bin/yapf"
Try only to Format On Save option:
Press Cmd + ,
Search for Format On Save option and chack it on.
Or add the following in settings.json:
{
"python.formatting.provider": "yapf",
"editor.formatOnSave": true,
}