UNPKG

tern-guess-types

Version:
40 lines (39 loc) 2.88 kB
{ "name": "tern-guess-types", "license": "MIT", "version": "0.10.0", "main": "guess-types.js", "author": { "name": "Angelo ZERR", "email": "angelo.zerr@gmail.com" }, "description": "A Tern plugin for guessing types.", "repository": { "type": "git", "url": "git://github.com/angelozerr/tern-guess-types.git" }, "scripts": { "test": "node ./test/all.js", "publish": "node ./scripts/git-tag.js" }, "dependencies": { "tern": "^0.15.0", "acorn": "^2.4.0" }, "devDependencies": { "test": ">=0.0.5", "codemirror": "^5.6.0" }, "keywords": [ "tern" ], "readme": "# Tern guess types\r\n\r\n[![Build Status](https://secure.travis-ci.org/angelozerr/tern-guess-types.png)](http://travis-ci.org/angelozerr/tern-guess-types)\r\n[![NPM version](https://img.shields.io/npm/v/tern-guess-types.svg)](https://www.npmjs.org/package/tern-guess-types)\r\n\r\n[tern-guess-types](https://github.com/angelozerr/tern-guess-types) is a plugin which gives the capability to guess parameter types when completion is applied to the JavaSript code intelligence system [Tern](http://ternjs.net/).\r\n\r\nFor instance if you open tern completion for `document` and select `addEventListener` : \r\n\r\n![Tern completion](https://github.com/angelozerr/tern-guess-types/wiki/images/TernCompletion.png)\r\n\r\nWhen you apply completion, tern guess types gives the capability to retrieve variables, functions for each function parameters. Here a screenshot which shows a list of variable with string type for the `addEventListener` type argument : \r\n\r\n![Tern completion](https://github.com/angelozerr/tern-guess-types/wiki/images/TernGuessTypes.png)\r\n\r\nSee [Features](https://github.com/angelozerr/tern-guess-types/wiki/Features) for more informations.\r\n\r\n# How it works?\r\n\r\n```javascript\r\ndocument. //addEventListener(type, listener, capture)\r\nvar s = \"\", y = \"\", z = 10;\r\nvar f = function(e) {\r\n\r\n} \r\nvar g = function() {\r\n\r\n}\r\nvar b = true;\r\n```\r\nJSON request : \r\n\r\n```json\r\n{\r\n \"type\": \"guess-types\",\r\n \"file\": \"#0\",\r\n \"end\": {\r\n \"ch\": 10,\r\n \"line\": 0\r\n },\r\n \"property\": \"addEventListener\",\r\n \"lineCharPositions\": true\r\n}\r\n```\r\n\r\nJSON response : \r\n\r\n```json\r\n{\r\n \"args\": [\r\n \"string\",\r\n \"fn(e: Event)\",\r\n \"bool\"\r\n ],\r\n \"string\": [\r\n \"name\",\r\n \"s\",\r\n \"y\"\r\n ],\r\n \"fn(e: Event)\": [],\r\n \"bool\": [\r\n \"true\",\r\n \"false\",\r\n \"closed\",\r\n \"b\"\r\n ]\r\n}\r\n```", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/angelozerr/tern-guess-types/issues" }, "homepage": "https://github.com/angelozerr/tern-guess-types", "_id": "tern-guess-types@0.7.0", "_shasum": "f48e214611edde4058a5b174e55d32361c7f827b", "_from": "tern-guess-types@^0.7.0" }