Atom editor not working showing failed to load snippets - atom-editor

Whenever I open my atom editor it always shows
Failed to load snippets from 'C:\Users\invisible.atom\snippets.cson'
C:\Users\invisible.atom\snippets.cson: missing / (unclosed regex)
What should I do how to get rid from this problem?

If your snippets in C:\Users\invisible.atom\snippets.cson are not enclosed in quotations like this:
'prefix': 'printf'
'body': printf("$1\n", $2);
According to this, you should put the snippet inside " or '.
'prefix': 'printf'
'body': 'printf("$1\n", $2);'
If that still didn't work, try disabling all your packages as suggested here.

Related

Atom -- snippets not working

The following are two of the snippets I have scripted in snippets.cson file:
'.source.python':
'print statement':
'prefix': 'pr'
'body' : 'print "${1:Hello world}"'
'.source.python':
'Argument variables import':
'prefix' : 'argv'
'body' : 'from sys import argv'
The first one doesn't work, but the second one does. Help please.
Ps.
The snippets file was BLANK when I first installed atom on my machine. I use Ubuntu 16.04. Is that normal?
I believe the root of your problem is that your scope .source.python was declared twice.
To answer your second question first, No, my snippets.cson file was not blank when I first opened it. Instead, it contained the following:
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson
(This is on MacOS, though).
Notice how it instructs you that each scope can only be declared once. I think if you modify your two snippets to be included in the same scope, they will work as expected.
Changing your snippets.cson to the following appears to work for me:
'.source.python':
'print statement':
'prefix': 'pr'
'body' : 'print "${1:Hello world}"'
'Argument variables import':
'prefix' : 'argv'
'body' : 'from sys import argv'
I can access both snippets from the snippets import menu once I make the .source.python scope unique.
Atom 1.53.0 x64 on Ubuntu 20.10 ("groovy gorilla"):
I had to disable the "build-in" snippets in "Settings" in the Core-Package "language-html" (0.53.1). From there I copied the snippet for a prefix, pasted it into my own local snippets.cson and changed it to my needs.
I also had to restart Atom to get the editor to show my custom snippet for usage.
The original snippets.cson was blank in my case, too. No hints, no example.
Pure vi-feeling :-)

vim-rmarkdown plugin configuration

I've just installed vim-rmarkdown, vim-pandoc, and vim-pandoc-syntax plugins in conjunction with Vundle (latest github versions).
When I open an RMarkdown file (.Rmd) in vim, as expected it detects the filetype as rmarkdown; it marks the start of an R code chunk with a lambda symbol etc. (replacing the ```), as I've seen on an example vim-rmarkdown screenshot.
What is driving me nuts is that vim has decided to highlight some strings (unhelpfully completely obscuring the text as if it were redacted). I would normally hit space to clear the highlighting of search terms; it isn't that. It also hides terminating ``` for R chunks; they only become visible when you move the cursor over that line.
Can anyone help with:
Pointers to vim-rmarkdown FAQs/docs (:h rmarkdown only calls up the same basic info you get on the github page),
Why it is overwriting (highlighting with solid colour) some text and how to stop it,
How to show the ends of R code chunks (```), or otherwise better manage distinguishing between "text" and R code chunks.
As per the vim-rmarkdown documentation available, I've added the following to the start of my .vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'vim-pandoc/vim-rmarkdown'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
Thanks for posting the question, I think I came across the same issues.
Pointers to vim-rmarkdown FAQs/docs (:h rmarkdown only calls up the same basic info you get on the github page),
As far as I can tell the vim-rmarkdown plugin just adds syntax highlighting for R code chunks and the :RMarkdown command described in the help docs. Most of the documentation that you're probably looking for is related to the vim-pandoc and vim-pandoc-syntax modules so :help vim-pandoc and :help vim-pandoc-syntax cover most of the issues.
Why it is overwriting (highlighting with solid colour) some text and how to stop it,
I don't know if you're having the same issue I am, but I saw this behavior because of the spell checking and the particular color scheme I am using in my terminal (iTerm with a dark color scheme) obscuring the text. It was solved for me by either turning off spell checking let g:pandoc#modules#disabled = ["spell"] or modifying the color scheme (in my case increasing the minimum contrast setting in iTerm helped)
How to show the ends of R code chunks (```), or otherwise better manage distinguishing between "text" and R code chunks.
My solution to this issue was to turn off concealing, it just confuses me anyway. (I'm not smart enough to handle an editor hiding stuff from me so I turn off folding too) There's probably a better way to deal with this for people who want concealing, but I don't know it.
The lines I added to my .vimrc to manage my issues with vim-rmarkdown:
" configuration for vim-pandoc and vim-rmarkdown
let g:pandoc#modules#disabled = ["folding", "spell"]
let g:pandoc#syntax#conceal#use = 0
The relevant setting you need to change can be found in the vim-pandoc-syntax plugin
Basically, putting this in your .vimrc should solve the issue:
let g:pandoc#syntax#conceal#use = 0
If you scroll down, you'll find a more granular way to disable this for particular filetypes, and specific settings for specific overrides, but it seems like you just want to disable it wholesale.
This seems to be in the documentation, but not the one from vim-rmarkdown (which, I admit, is a bit confusing). Try :help pandoc-syntax and you should find explanations on all the settings.
Some general explanation on hiding text with syntax settings can be found with :help conceal.
Just to pull together the helpful answers I got, in case anyone else comes by this post:
adding to my .vimrc,
let g:pandoc#modules#disabled = ["spell"]
directly solved the issue of some text ("words") being completely obscured (in my dark-theme terminal editor);
let g:pandoc#syntax#conceal#use = 0
directly resolved what (to me) was somewhat over-zealous concealing of code segments.
:help pandoc-syntax
is generally very useful documentation for controlling the syntax highlighting used my rmarkdown.
Thanks to all.

How to automatically enter brackets on autocomplete?

Whenever I use the autocomplete for atom it doesn't include the brackets. For example if i start typing "print" I hit enter and it enters print but doesn't include the brackets.
The default Python snippets only supports the print keyword, not the print() function. Since I haven't found another package that does, you're problably best off adding a snippet (Atom > Open Your Snippets) such as:
'.source.python':
'print()':
'prefix': 'print-function'
'body': 'print($1)'
The prefix will trigger the snippet defined in the body, in case prefer to call it differently.

How to correctly combine "dot notation" and "braces notation" in cocoascript (sketch)?

In sketch documentation it's stated that dot and braces notations can be mixed with each other. It's even an example available:
[[context.document currentPage] deselectAllLayers];
Unfortunately, this code doesn't work in sketch and produce error if executed by "run custom script" command:
SyntaxError: Unexpected identifier 'currentPage'. Expected either a closing ']' or a ',' following an array element..
Plugin “untitled script”, line 2.
» [context.document currentPage]; «Error in command untitled script Script at path (null) does not contain a handler function named: onRun
Script executed in 0.023666s
This can be avoided by adding additional ( and ):
[[(context.document) currentPage] deselectAllLayers];
Why this happens? Is it any documentation available how exactly braces and dot notation can be mixed? Is it some error or expected behaviour?
It seems to me it's an error, but in Sketch documentation. Besides this case you showed, I couldn't find any other example where dot and braces notations are used together in the same statement, without parentheses.
The documentation page about Selections, for instance, tells that you'd use the following code to unselect everything:
var doc = context.document
[[doc currentPage] deselectAllLayers]
Follow this link and look under Clearing the selection header: http://bohemiancoding.com/sketch/support/developer/02-common-tasks/01.html
Even their example plugins don't mix both notations, as you can see here: https://github.com/BohemianCoding/ExampleSketchPlugins/blob/master/Hello%20World/Hello%20World.sketchplugin/Contents/Sketch/script.cocoascript.
In that example, context.document is also assigned to a new variable before being used within braces.

Where is keywords code assist and letter not allowed problem(Aptana Studio 3)

I recently switched from Aptana2 to version3.0.3, and the first thing i did was to install the sdomcl. file to get jQuery code assist.It works fine for jQuery, but there is no code assist for many keywords.For exymple there is no support for var,while,throw,try,break,case,catch etc.
Also there is no function, instead intellisense sugests Function.
The second problem is that i am constantly getting this warning '<' + '/' +letter not allowed here when typing something valid like this:
confirmDiv =$("")-sorry for this,but it wont let me type what i want, basically i am just creating a new div with the correct syntax.
Could it be something with Html Tidy?Anyways, big thanks in advance!
Aptana Studio 3.0.4 includes code assist for JavaScript keywords.
I've read that for Javascript the slashes / must be escaped with backslashes \ as it says here
Doing so the warning dissapears ;)

Resources