Error running CoffeeScript in Sublime Text 2 - coffeescript

I am new to both CoffeeScript and Sublime Text 2, so any help would be greatly appreciated.
When I try to compile a CoffeeScript test file in Sublime, I get the following error message:
[Error 2] The system cannot find the file specified
[cmd: [u'coffee', u'-c', u'C:\\Users\\username\\Desktop\\test.coffee']]
[dir: C:\Users\username\Desktop]
[path: $HOME/bin:/usr/local/bin:$HOME/bin:/usr/local/bin:C:\Program Files (x86)\ImageMagick-6.9.1-Q16;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_25\bin;C:\Java\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby2.1.0\bin;C:\Users\username\AppData\Roaming\npm]
[Finished]
Here are my build settings in commands:
{
"path": "$HOME/bin:/usr/local/bin:$PATH",
"cmd": ["coffee","-c","$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.coffee, source.litcoffee, source.coffee.md"
}
Any idea how to fix this problem? Thanks.

I managed to get it working with the following code in the build file:
{
"cmd": [ "coffee", "-m", "-c", "$file" ],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.coffee, source.litcoffee, source.coffee.md",
"windows":
{
"shell": true
}
}

Related

vscode+Arduino environment: vscode is not able to load system headers despite the configuration of paths

I'm really getting frustrated with this issue.
I have installed vscode(version: 1.69.2) & Arduino IDE(version 1.8.20) on my MacOS(version 12.5), I installed the Arduino extension in the vscode, and tried to get it work.
It just works fine if I don't include the system libraries, however if I tried to include a header file, example, the 'iostream', the complier prompts me as below:
Alternatives for iostream: []
ResolveLibrary(iostream)
-> candidates: []
main:1:10: fatal error: iostream: No such file or directory
#include <iostream>
^~~~~~~~~~
compilation terminated.
exit status 1
It looks like the VScode IntelliSense could find this file, if I click this file with Command key pressed, it will show me the location of it.
iostream can be found by vscode IntelliSense
I'm assuming that IntelliSense works with the paths I set, but the compiler just cannot, I tried editing the json file several hours last night but still no luck.
Anyone has any idea about this? Your help is greatly appreciated!
Here's part of my c_cpp_properties.json file:
{
"version": 4,
"configurations": [
{
"name": "Arduino",
"compilerPath": "/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++",
"compilerArgs": [
"-w",
"-std=gnu++11",
"-fpermissive",
"-fno-exceptions",
"-ffunction-sections",
"-fdata-sections",
"-fno-threadsafe-statics",
"-Wno-error=narrowing"
],
"intelliSenseMode": "gcc-x64",
"includePath": [
"${workspaceFolder}",
"/Users/steveyang/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino",
"/Users/steveyang/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard",
"/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include",
"/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include-fixed",
"/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include"
],
"forcedInclude": [
"/Users/steveyang/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/Arduino.h"
],
"cStandard": "c11",
"cppStandard": "c++11",
"defines": [....
],
"browse": {
"path":[
"${workspaceFolder}/",
"/usr/local/include",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
]
}
}
]
}

How to fix: "The asset path must start with the project source root"?

We have an nrwl/nx project, that we can build on Windows, but it fails on Linux (Ci sytem).
The error is:
The /root/dev/apps/dmc-svr/src/assets asset path must start with the project source root: apps\dmc-svr\src
It seems to be a Windows/Linux path issue
The problem was a Windows like path for the sourceRoot property in project.json
{
"sourceRoot": "apps\\dmc-svr\\src",
"targets": {
"build": {
"executor": "#nrwl/node:build",
"options": {
"assets": [
"apps/dmc-svr/src/assets",
]
}
}
}
}
the fix is to simply replace the backslash \\ with a slash \: sourceRoot": "apps/dmc-svr/src"
We guess that this has been generated by some nx-schema.

How to run jsdoc on directory ignore .gitignore files

I can run jsdoc on a whole project with
$ jsdoc -r .
However this generates docs for js files inside node_modules. How can I tell jsdoc not run on files in .gitignore?
How about using a config file such as this one?
$ jsdoc.js -c ./.jsdoc.conf.json
./.jsdoc.conf.json
{
"source": {
"include": ["."],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "node_modules"
}
}
Borrowed from Generate jsdoc documentation here on Stack.
{
"source": {
"include": ["."],
"includePattern": ".(jsx|js|ts|tsx)$",
"exclude": [
"node_modules",
"docs"
]
}
}

how to pass multiple args to vscode task command?

in tasks.json I am using the "args" property to specify the arguments to pass to "command":"gulp". But when I run the task in vscode, only the first argument is being passed to gulp.
I want to run a gulp task against a single file. In gulpfile.js I am using the process.argv array to retrieve the command line arguments. So, on the command line I enter "gulp copy3 --file abc.js" and the copy3 task is run. The code then reads the argv array to get the name of the file being copied.
this code works from the command line. But does not work when I run it as a task in vscode. How to do that?
the gulpfile.js code:
gulp.task('copy3', function( )
{
console.log(process.argv) ;
let pattern = '*.js' ;
// single file to copy
if (( process.argv.length >= 5 ) && ( process.argv[3] == '--file' ))
{
let fileName = process.argv[4] ;
pattern = fileName ;
}
console.log('pattern:' + pattern ) ;
return gulp.src(pattern).pipe(gulp.dest('dev'));
}) ;
the tasks.json file
{
"version": "2.0.0",
"tasks": [
{
"taskName": "copy3",
"command": "gulp",
"args": [ "copy3", "--file", "${fileBasename}" ],
"problemMatcher": []
}
]
}
Here is the terminal output:
[10:52:57] Using gulpfile C:\vscTest\rpgproj\gulpfile.js
[10:52:57] Starting 'copy3'...
[ 'C:\\Program Files\\nodejs\\node.exe',
'C:\\vscTest\\rpgproj\\node_modules\\gulp\\bin\\gulp.js',
'copy3' ]
pattern:*.js
[10:52:57] Finished 'copy3' after 16 ms
thanks,
I made a couple of small changes, try:
{
"label": "Tasks: copy3",
"type": "shell",
"command": "gulp",
"args": [ "copy3", "--file", "${fileBasename}" ],
"problemMatcher": []
}
and your entire code works perfectly. Make sure to reload vscode after modifying the tasks.json.
VSCode appears to have a built-in gulp extension. This seems to scan your gulpfile for tasks and list them for you. It also seems to ignore the args option.
The workaround is to use the full path to gulp as the command e.g. ./node_modules/.bin/gulp to bypass it.

Configure Sublime Text build system for Scala?

I'm trying to configure a build system for Scala with SublimeText, but I am having some difficulty. I have tried both of the following:
{
"shell_cmd": "scala",
"working_dir": "${project_path:${folder}}",
"selector": "source.scala"
}
{
"cmd": ["/path/to/bin/scala", "$file_name"],
"working_dir": "${project_path:${folder}}",
"selector": "source.scala",
"shell": true
}
Both of these attempts produce the same failed output - it seems to start up the interactive Scala shell rather than running my script. Any advice?
The answer that worked turned out to be very close to the second answer - apparently I'm not supposed to open up a new shell. If someone can clarify when to set "shell": true in the comments, that would be really helpful.
{
"cmd": ["/path/to/bin/scala", "$file_name"],
"working_dir": "${project_path:${folder}}",
"selector": "source.scala"
}
{
"cmd": ["C:/Program Files (x86)/scala/bin/scala.bat", "$file_name"],
"working_dir": "${project_path:${folder}}",
"selector": "source.scala"
}
This worked for me.
replace C:/ with your own path.
In Packages/Scala/Scala.sublime-build, add this:
{
"cmd": ["[PATH TO SCALA]", "$file"],
"working_dir": "${project_path:${folder}}",
"selector": "source.scala"
}
Replace the [PATH TO SCALA] with the path of where scala interpreter is located in your system. Do a "which scala" to find out.
This works for me:
{
"cmd": ["scala", "$file"],
"working_dir": "${project_path:${folder}}",
"selector": "source.scala",
"shell": true
}
given you set the system PATH thing:
Variable: %PATH%
Value: C:\Program Files (x86)\scala\bin
in my case I didn't install Scala or SublimeText, I just used the zip. But this code worked for me to compile the .scala files from SublimeText3 on Windows.
{"cmd": ["C:/Scala/scala-2.13.3/bin/scalac.bat", "$file"],
"working_dir": "$file_path",
"selector": "source.scala",
"encoding":"utf-8",
"file_patterns": "*.scala",
"shell": true}
You can create it or download it and put it in the directory Sublime Text Build 3 ###\Data\Packages\User
Build System For Scala :
OSX - (Mac)
Use the below:
{
"cmd": ["/opt/homebrew/bin/scala", "$file_name"],
"working_dir": "${project_path:${folder}}",
"selector": "source.scala"
}
Path to delete the build:
/Library/Application Support/Sublime Text/Packages/User