R / VSCode / Radian: Comma at end of line breaks execution - r

I'm trying to use VSCode for R scripts, along with the Radian terminal. I'm on Mac OS 10.14.6 (Mojave). Installation went fine. But now when I try to execute a multi-line block of code, if a line of code ends with a comma then the code to that point gets sent to the console as a complete statement, which of course generates an error. I've read https://github.com/REditorSupport/vscode-R/issues/437, but it doesn't seem to be addressing the same thing.
Here's a quick example of something that causes the problem:
mydf <- data.frame("Cat" = c("A", "B", "C"),
Values = c(12, 10, 15))
Both lines get sent to the console for execution separately, and of course both throw errors.
At the suggestion of a commenter below, here's my settings.json file:
{
"window.zoomLevel": 1,
"workbench.colorTheme": "Abyss",
"editor.wordWrap": "bounded",
"editor.wordWrapColumn": 100,
"editor.tokenColorCustomizations": {
"comments": "#7c9478"
},
"workbench.colorCustomizations": {
"editor.selectionBackground": "#0000ff"
},
"diffEditor.wordWrap": "on",
"launch": {
"configurations": [],
"compounds": []
},
"liveServer.settings.AdvanceCustomBrowserCmdLine": "Chrome",
"editor.inlineSuggest.enabled": true,
"terminal.integrated.enableMultiLinePasteWarning": false,
"r.bracketedPaste": true,
"r.plot.useHttpgd": true,
"r.alwaysUseActiveTerminal": true,
"r.rpath.mac": "/Library/Frameworks/R.framework/Resources/bin/R",
"diffEditor.ignoreTrimWhitespace": false,
"r.rterm.mac": "/usr/local/bin/radian",
"r.rterm.option": [],
"terminal.integrated.env.osx":{
"R_HOME": "/Library/Frameworks/R.framework/Resources"
},
}
Any ideas, anyone? Big thanks.

Thanks for the comments, everyone. This turned out to be a problem with settings.json scope. I had somehow made the change to r.bracketedPaste (setting it to true) in the user and default settings, but not the workspace settings, where it was still set to false (as you can probably tell, I'm new to vscode). Changing the setting at the workspace level did the trick. Sorry for the false alarm, and thanks again for the suggestions.

Related

How to clean object on insert

I'm having trouble finding a solution to this. It's quite possible I'm using the wrong terminology so feel free to correct me and put me on the right path.
I'm using to using a plugin called simple-schema with meteor that cleaned, null or "" fields when you used insert to create a document. See below.
Uncleaned document
{
"_id": "f3iujiimjHo4m3Cqj",
"monday": true,
"tuesday": ""
}
Cleaned document
{
"_id": "f3iujiimjHo4m3Cqj",
"monday": true
}
I can't find anything on how this is done. Can someone please tell me what I'm missing.
I use obj-clean to do this.
install
meteor npm install --save obj-clean
Usage
import clean = from 'obj-clean'
const dirty = {
"_id": "f3iujiimjHo4m3Cqj",
"monday": true,
"tuesday": ""
}
const cleaned = clean(dirty)
Thats it, more on the npm package page

Meteor error 'cannot declare let twice' when minifying

When minifying meteor app, safari on IOS 10 throws the following error
SyntaxError: Cannot declare a let variable twice: 't'.
I have tried to remove standart-minifier and added abernix:standart-minifier as it was recommended on this comment - they work fine on all the other browsers but on safari ios10 it crashes.
Do you have any recommendations?
Thanks a lot
Edit:
I ended up removing minify packages as it was mentioned here however it definitely not a long-term solution.
The solution to this ios10 safari bug is
here
Problem is caused by minify default option
safari10:false
to solve the problem
find these files
/Users/USER/.meteor/packages/abernix_standard-minifier-js/.2.1.0.1v4h096++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/abernix_minifier-js/node_modules/uglify-es/lib/minify.js
and
/Users/USER/.meteor/packages/abernix_minifier-js/.2.1.0.106pai4++os+web.browser+web.cordova/npm/node_modules/uglify-es/lib/minify.js
then find the following lines and change it as "safari10:true"
if (options.mangle) {
options.mangle = defaults(options.mangle, {
cache: null,
eval: false,
ie8: false,
keep_classnames: false,
keep_fnames: false,
properties: false,
reserved: [],
safari10: true,
toplevel: false,
}, true);
}

Error "LB: Transpiled file would overwrite source file. Aborted!"

I've been given a coding task as part of a job interview it's a little outside my ken but I'm trying it anyway. They've given me their boilerplate and asked me to make certain changes. It is a React app built with webpack.
When I try to edit a file [addendum: I should have said "edit and save"], I get the Error "LB: Transpiled file would overwrite source file. Aborted!"
I assume the "LB" refers to language-babel. I can get it to work by disabling language-babel. Maybe I'm confused, but aren't source files exactly what I want to edit? I've never had this problem on any other project on which I've worked.
I've searched and can't find much on this error. I'm on Windows 10 with Atom 1.19.7 X64 and language-babel 2.75.2.
The .babelrc that came with the boilerplate is:
```
{
"presets": ["react", "es2015"],
"plugins": [
["import", [{
"libraryName": "antd",
"style": "css"
}, {
"libraryName": "lodash",
"libraryDirectory": "",
"camel2DashComponentName": false,
}, {
"libraryName": "components",
"libraryDirectory": "",
"camel2DashComponentName": false,
}, {
"libraryName": "HOCS",
"libraryDirectory": "",
"camel2DashComponentName": false,
}]],
"transform-runtime",
"transform-class-properties",
"transform-object-rest-spread",
"dynamic-import-node",
]
}
```
Thank you in advance for your help.

grunt jshint config not working

Having trouble setting up jshint options for grunt
Here is my gruntfile.js
grunt.initConfig( {
jshint : {
options: {
curly: false,
asi: true,
eqeqeq: false,
maxparams: 5,
undef: false,
unused: false,
eqnull: true,
browser: true,
devel: true,
expr: true,
jquery: true ,
evil : true
},
files : {
src : [
'dev/*.js', 'dev/**/*.js' ,
'files-lib/*.js', 'files-lib/**/*.js' ]
},
},
still getting the errors
71 | return (this.optional(element) && value=="") ||
re.test(value);
^ Use '===' to compare with ''.
Thanks for helping
short answer: There's nothing else you can do in your options configuration to avoid this.
longer answer: Although you have the eqeqeq property set to false in your options configuration, (which assumes instances of the double equals == should not throw an error), jshint in this instance I believe is correctly reporting this as an error.
The value=="" part in the code being validated is what is throwing the error (i.e. it's ignoring the eqeqeq: false option). This is for good reason!
The == operator will compare for equality after doing any necessary type conversions, which can lead to really quirky results in Javascript. For example:
0 == "" // true
false == "" // true
Whilst I appreciate double equals yields the correct result for many comparison scenarios, this value=="" example is certainly a scenario whereby triple equals should be used, or if you're a double equals only person, then you could replace value=="" with value.length == 0
Additional info regarding triple equals and double equals operators, and it's various quirks, can be found in the answer to this post

Searching custom fields in Maniphest (Phabricator)

I set up a custom field in Maniphest as a drop down. It assigns the correct value to each task, but the copy and search function don't work at all.
If I try to search by a value in this field, everything comes up matching all the other search criteria and ignores my custom field.
If I create a similar task, it always defaults back to the first option in the list.
{
"my-comp:task-type": {
"name": "Type",
"type": "select",
"options": {
"my-comp:bug": "Bug",
"my-comp:feature": "Feature",
"my-comp:ui": "UI",
"my-comp:improve": "Improvement",
"my-comp:misc": "Misc",
"my-comp:planning": "Planning"
},
"required": true,
"search": true,
"copy": true
}
}
Copy currently doesn't work: T8055. There doesn't appear to be a workaround offered at this time.
As for the search, what version are you running? I am running commit 2eab1c1943c511 from the stable branch and I am not experiencing the issue. I also upgraded to f2b2264e8def0a and I still didn't have the issue. I think you may need to upgrade your version of Phabricator.

Resources