I'm new to VS Code and am trying to get IntelliSense code completion working for both dojo and arcgis api for javascript. I've installed both type definitions globally using typings. I get parameter hints on methods only after they've been completely typed out but no suggestions while typing. (I should clarify that I do get suggestions but just not for the methods/parameters I'm looking for.) I've tried both jsconfig and tsconfig (with allowJs set to true) with the same result.
Example for dojo string substitute() method:
No suggestions :
Parameter hints :
As you can see from the images , it appears to be referencing the type definitions but for some reason its not providing the suggestions for autocomplete. I'm obviously missing something or just don't understand how its supposed to work.
Any help would be greatly appreciated. Thanks
Autocomplete currently can't be accomplished with JavaScript because of the way dojo asynchronously loads modules. However, it can be accomplished with TypeScript by tricking ts that your dojo classes are ts classes. https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/dojo
Related
I have found the settings in Visual Studio Code to enable type checking for JavaScript in JS files. Such that: Bad code is highlighted and it also shows the reason why it's bad code
This behavior does not occur for JavaScript code in Vue files. I have searched through all the settings in Visual Studio Code. I have scoured the internet for any extension that can do this for me to no avail.
How can I make my Vue files type-check the JavaScript in them?
LOL. I found the answer.
All I had to do was add //#ts-check directly underneath the script tag and type checking was enabled.
So HAPPY!!!
Thank you, everyone, for your input
For best results I'd suggest starting a new project using vue-cli and selecting the options for TypeScript and ESLint. You'll also need the ESLint extension for VS Code.
Here's a helpful blog post showing the parts of this process.
Once you have a nicely working setup with the clean project, then move the code over. I suggest this because getting all the config right can be a mess with an existing project.
Hi I am trying to add watermark to the image and i am trying to include watermark.js to the angular 4. Could someone please tell me how to include watermark.js in angular. I tried installing using
npm install watermark -save
and then using the
import * as watermark from 'watermark';
but the above line throws me an error stating cannot find module 'watermark'
can someone please tell how i can import the watermark.js and use it to watermark my image?
You're missing type definitions for watermark.js. However, judging by this github issue, the authors of this lib currently don't offer them.
You have a couple of possibilities to fix this:
Declare type definition manually. This is the quickest way, but you'll also lose all type safety when it comes to using this lib
Help with creating proper type definitions (as shown in this tutorial). This way you'll be type safe, learn a lot about the TS type system, and, as a bonus, contribute back to the OSS community.
Good luck!
I have Javascript libraries downloaded in different folders, how do I set the path for them to be picked up by sublime. (and hopefully also show autocomplete for them)
I believe the right way to get the library into a js file is this:
var highcharts = require('highcharts');
Neither does it pick up the library nor does it do any autocomplete.
I've had problems with Emmet (same as the one mentioned here https://github.com/sergeche/emmet-sublime/issues/129) so I have the following plugins installed:
Javascript Next
Javascript Completions
SublimeCodeintel
SublimeLinter-jshint
For the autocompletions I've already asked a question (https://stackoverflow.com/questions/29079474/get-autocomplete-for-new-javascript-libraties-in-sublime) but the problem I want to get solved here is getting the library recognized and thereby suggest autocomplete.
Thanks.
Try All Autocomplete plugin, it finds matches in all open files of the current window.
I just started using WebStorm and JSDoc to document my JavaScript. Still I have not found a way to generate a HTML documentation using some kind of WebStorm built-in functionality. I searched the web and Stack Overflow, but only found a lot of questions about the syntax of JSDoc, etc.
What am I missing? I am using WebStorm 7.0.3.
Since Webstorm v8.0.0, you can create JSDoc comments by simply typing /** right before the method or function declaration you want to add the documentation, and then press Enter, this will generate a basic block with all your parameters already set.
More info on this Webstorm article.
Nice article about jsDoc for phpStorm at this link.
In WebStorm I guess the same.
WebStorm has no built-in functionality to generate documentation. You can use external solutions for that, at least as https://github.com/jsdoc3/jsdoc
I use jsduck for that: https://github.com/senchalabs/jsduck
WebStorm has a built-in function to help a little when creating JSDoc documentation in your code, they explain it in this article. As far as I could look for, there's no plugin on the WebStorm plugin store to further help us creating nor rendering JSDoc documentation. For that, you would need to use external tools.
Goal
My goal is to get an UML model out of my JavaScript project (consisting of several .js files) and store it as XMI.
How far I've come
I searched the internet and found out js/uml is the first place to go.
I've managed it to get the js/uml plugin running with Eclipse 3.7.1 (Win32) and a local installation of my pre-downloaded additional plugins:
mdt-uml2tools-Update-incubation-I201103290512.zip (installs required org.eclipse.uml2.diagram.clazz 0.10.0)
jsuml-eclipse-0.8.4.zip (only works with Eclipse 3.7.1 (Indigo))
I loaded the provided example project jsuml-example-yui-0.8.4.zip into Eclipse and added all my .js files to this project also.
Problem
Now I'm stuck and do not get it how to call the reverse engineering of my .js files. I can call 'New'->'Other'->'UML 2.1 Diagrams'->'Class Diagram' from the project's context menu, but I don't get the following steps of that assistant dialog, nor do I get it if this is the right way at all. Please, could you help me with an easy understandable click tutorial? The js/uml homepage does not explain it well enough IMHO. Thanks for your help in advance.
Someone adapted UML for web artifact, its called the "WAE" extension of UML. This way you can see not only your javascript files but the html and css. If you work with node.js, i created a module that generate class diagram for javascript/node/html/css. Its called wavi. For javascript, function,variable are automatically recognized. You can use it for documenting your application.
https://www.npmjs.org/package/wavi
Well, I think I have come quite close.
There's a command-line tool called Code2Flow. which uses GaphViz to generate graphs for Python and JavaScript sources.
I tried it, it does generate the graphs but somehow i can't make to do right.
I hope this will help you or someone.