visual studio code and Parse.com autocomplete? - javascript

Is it possible in any way to make Microsoft Visual Studio Code to auto complete Parse JS SDK? I know it is possible with some other IDEs by importing the parse-1.5.0.js file, but i found this IDE better...

With nodejs and npm-cli installed, get definition file packager manager(tsd-cli) and install parse.d.ts:
npm install -g tsd
tsd install parse --save
Use tsconfig.json or jsconfig.json to enable autocomplete without reference by comments.
VSCode will find parse.d.ts file and just works!
This process is same to any other library.

Related

nodeJS: Command not found when installed a library from source code instead of npm library

I am trying to install nodeJS library by downloading the source code instead of npm library, because I want to use some new features that are not present in the official library yet but I am getting command not found error.
I am trying install this package https://www.npmjs.com/package/bids-validator
I was able to use npm install -g bids-validator and it is installing the package and I am able to use it.
But If download source code from GitHub https://github.com/bids-standard/bids-validator and go to the the folder and use npm install, I didn't get any installation errors but I am getting following error
'bids-validator' is not recognized as an internal or external command,
operable program or batch file.
How do I fix this?

How to update the version of TypeScript?

How to update the version of TypeScript for visual studio 2015 ASP.net MV5 project?
I searched using the Nuget but did not find it.
I have a problem in the razor intellisense (index.d.ts file) and need to updated to check if this will help.
To update TypeScript globally, run:
npm install -g typescript
Or just within a project:
npm install -save--dev typescript

Visual Studio Code Intellisense not working for Javascript

I am using Visual Studio Code (VSC) 0.10.11 on Windows and Mac. For the purpose of this question I have this small JavaScript snippet:
'use strict';
const os = require('os');
console.log(os.homedir());
I followed John Papa on Visual Studio Code (Blog entry and Pluralsight Visual Studio Code JavaScript Intellisense - for those who have an account) and therefore I would expect that VSC provides Intellisense and Quick fix options when typings are available.
In the snippet above VSC recognizes console and log() (I use hoover, but it is the same with Intellisense):
but not os and homedir():
But all 4 typings are available in typings/main/ambient/node/index.d.ts. I know that the difference is the require in the case of os, but in John Papa's video course VSC also provided IntelliSense for required modules. A difference is that John Papa used tsd while I am using typings.
So my questions are
how can I enable Intellisense for all known typings?
what do I have to do that VSC offers me Quick fix (green line under moduls with missing typings)?
The above links are outdated. In older versions of VS Code you needed to reference your typings like /// <reference path> for somelibrary.d.ts.
With new version you need to initialize your project by creating jsconfig.json at the root of your project and add the following inside:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs"
},
"exclude": [
"node_modules"
]
}
Next install typing you need. You can use either tsd or typings. In your case you need to install tsd install node or typings install node --ambient. Make sure you have typings/tsd installed. Restart project.
Please refer to docs:
Setup JS project - https://code.visualstudio.com/docs/languages/javascript
Node.js - https://code.visualstudio.com/docs/runtimes/nodejs
Debugging - https://code.visualstudio.com/docs/editor/debugging
Update:
Since version 1.7 there is no need to manually install typings, they should be downloaded automatically. Better JavaScript IntelliSense
There is a built-in extension called TypeScript and JavaScript Language Features (vscode.typescript-language-features) that is disabled.
In order to enable it, open Extensions panel, search for "#built-in JavaScript", and enable the required extension.
Now you should be able to use the autocomplete feature.
I experienced this on global "process" object. Vscode enabled intellisense for process object, only if I add any "require" statements to the file.
So if there is not any other require statements, you can add
const process = require('process');
in the beginning of your script to get intellisense.
Well, after 4 hr's googling finally, I decided to uninstall nodejs, npm, and typescript then install all of them again. The previous time I installed them using nvm but this time I decided not to use nvm just install them from node source since I am using Ubuntu I executed bellow commands, for windows or mac just install them without any package or version manager.
curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs
above command installed both nodejs and npm, after then to install typescript I ran bellow command
sudo npm install --global typescript
I updated my VSCode to the newest version.
Then in the bottom right of my VSCode I clicked on javascript to change the language mode, I wrote 'type' on the search bar and select typescript as my new selected language mode...........BINGO

How do I use JSDoc on Windows?

Forgive me if this is a daft question but I'm utterly baffled as to how I can use JSDoc on Windows. I'm aware of JSDoc-Toolkit but it's a bit out of date and the google code repository recommends to use JSDoc 3 instead. I have downloaded JSDoc from Github and unzipped the jsdoc-master folder onto my local disk but can't find any solid information as to how to use it to parse my files.
You can download it as an npm package for the Node.js JavaScript runtime environment.
Install Node.js which comes with npm
Open your a command line
Install JsDoc by typing the following command
npm install -g jsdoc
Run JsDoc / generate documentation. more info
jsdoc path/to/file.js
Configure jsdoc (Optional)
The installation is not good documented on the project-page.
It is much better exlained on the github-page.
I don't know very much about NodeJS/npm ecosystem. However, I did the following steps below and it worked for me (on windows):
Downloaded NodeJS zip file and extracted, it made a directory 'node-v16.15.1-win-x64' with node.exe and and npm.cmd inside
Executed command 'npm install -g jsdoc', under the 'node_modules' directory under the 'node-v16.15.1-win-x64' it installed the jsdoc (in a folder) and also made the jsdoc.cmd file inside 'node-v16.15.1-win-x64'.
This jsdoc.cmd works with the full path but it does not work without the full path
jsdoc gets installed and is working with the above steps but to access it from any where without giving the full path, I had to set the 'node-v16.15.1-win-x64' on Windows PATH, that works.
I am not sure if question of OP is answered but JSDoc works for me this way.
I'm not saying this is necessarily the best way, but it worked for me:
Install node.js
Open a command prompt
As a test, create a folder in your root drive (c:\test) and go to it (cd\test). I guess there was some sort of permission issue as I couldn't get the following steps to work in my desktop folder.
Install the JSDoc package: npm install jsdoc
There should be a folder in test called node_modules
Go to the .bin subfolder in node_modules
There should be a file called jsdoc.cmd. Simple use jsdoc myfile.js in the command prompt to execute the JSDoc script on your file

How to use installed package on node.js?

I'm using FoundationPress theme for WordPress and installed it using Node.js. Now I want to install Perfect Scrollbar and I did so using npm install perfect-scrollbar but I don't know how to use it. I can now see it under node_modules. I don't know where to import the css and the js file.
I import .scss using the foundation.scss file. I'm adding the js by adding a .js file to js/custom and then running grunt build.
Do I also put it there or there's a nicer way to use the installed package? I've also run grunt build but didn't see the script running in my theme.
I'm using Git Bash command line to do all this. Not sure if that helps. I have only started using Node.js

Categories

Resources