mortalapeman / lt-ternjs Goto Github PK
View Code? Open in Web Editor NEWA TernJS plugin for Light Table
License: Other
A TernJS plugin for Light Table
License: Other
Tern supports condensing an inferred set of type to a JSON description document. The idea being that big libraries can be analyzed once, dumped, and then cheaply included in later analysis or modified to add documentation.
Hi,
I don't know if this is expected behavior or not. When using the LT-TernJS plugin I constantly have the following error in my console.
Error channel closed
at ChildProcess.target.send(child_process.js:402:26)
at eval...
...
I have tried running it with the default behavior and also adding the following to my workspace.behaviors.
{:+ {:tern.config [(:lt.plugins.tern/libs :ecma5)
(:lt.plugins.tern/plugin :node true)]}
:- {:tern.config [:lt.plugins.tern/libs :ecma5 :browser :jquery :underscore]}}
I get some form of auto-completion although it is very noisy and near useless in that form to me.
When I try the jump to definition feature I simply get a "Disconnected from Tern Javascript Server" message in the console and nothing happens.
When I try the in-line documentation feaure the same error happens: "Disconnected from Tern Javascript Server" and nothing happens.
I think I just don't get I to set it up properly or something.
It shoud be cool if Light Table editor could displays errors of the tern lint https://github.com/angelozerr/tern-lint which is a tern plugin to to validate JS files with tern.
You can see what tern lint is able to validate here :
You can see the editors which support tern-lint at https://github.com/angelozerr/tern-lint#editors
While configuring tern through the default behaviors is definitely a route to take, it would be nice to offer a behavior that reads a .tern-project file and sends it to the server. Any relative file paths would need to be converted to absolute path, relative to the file's location.
Hi !
I've failed to get my lt-snippets hints to play nicely with hints from this plugin. Basically I'm trying to append hints from my plugin to whatever else there might be of hints from other plugins. It's entirely possible its all my fault, but it does work for other plugins (clojure, the core javascript plugin to name a few).
Could the reason be that this behaviors return hints isn't actually appended to the hints input parameter ?
Similar to this
I'm not sure if I should report this here or at tern.js. While using LightTable, sometimes I notice the fans are blowing full speed non stop. When looking at the task manager, I see that a node process that runs ternserver.js is using one of the CPU cores at 100%. If I close LightTable and start it again, I may and with several instances of this process, each using one core.
In the editor sometimes I notice that autocomplete acts weird. The suggestions close immediately without having time to choose one, or existing variables are not suggested. After 5 or 10 seconds it starts working again.
I posted a screenshot and a comment about it in the LT issues.
Is there anything I can do to help find why this is happening?
Light Table Version: 0.8.0
Platform: Windows x64
TernJS Version: 0.1.9 (According to Plugin Manager)
Fails with:
TypeError: Cannot read property 'call' of undefined at Function.__BEH__start_server
(ternjs_compiled.js:423:23)
... bunch of bootstrap.js logs...
at Function.__BEH__try_send (ternjs_compiled.js:510:25)
I would really like to use this plugin on Light Table. Let me know if you need any other info.
If I open a new editor and set editor syntax to javascript, autocomplete starts to report errors in the console
typically:
Uncaught Error: No protocol method IDeref.-deref defined for type null:
(mac os/x lt 0.6.5 plugin v 0.1.2)
Currently, the nodejs file used to setup the Tern server loads all JSON defs found in the provided node module. We need a way to configure which defs get loaded by the tern process that fits with the Light Table architecture.
I was thinking of using behaviors for the configuration like below:
{:+ {:tern-client [(:lt.plugins.tern/use-def "jQuery.json")]}}
Since behaviors can be setup on the workspace level, this seemed like a good path to investigate. We would need to a way inform the Tern server if behaviors change and I'm sure there are other issues I haven't thought of just yet.
When i close LightTable, TernJS continue to work on background :
/opt/LightTable/plugins/node/node /home/armaklan/.config/LightTable/plugins/TernJS/node/ternserver.js --harmony
OS Linux
LightTable 0.6.5
Plugin v 0.1.5
When first started, the plugin reads all .js files found in one's workspace synchronously. Currently all directories are read in, including the node_modules
directory if it exists. Tern's node plugin appears to be able to load modules just like node, so we can probably exclude the node_modules
directory completely when doing our .js file crawl.
It would also be preferable to move to an async file search, probably utilizing LT's background macro. That way we don't lock up the UI when initializing the Tern server.
EDIT: This issue originated from a problem described here but has since been repurposed. The root cause of the original issue has proven to be elusive.
Currently, the nodejs file used to setup the Tern server loads all plugins found in the provided node module. We need a way to configure which plugins get loaded by the tern process that fits with the Light Table architecture.
I was thinking of using behaviors for the configuration like below:
{:+ {:tern-client [(:lt.plugins.tern/use-plugin "angular.js")]}}
Since behaviors can be setup on the workspace level, this seemed like a good path to investigate. We would need to a way inform the Tern server if behaviors change and I'm sure there are other issues I haven't thought of just yet.
Tern server never connects even though it is installed via npm.
https://github.com/angelozerr/tern-guess-types is helpfull when completion is applied. I use it inside tern.java. It should be cool if you could integrate it with Light Table. Thanks!
Tern supports rename refactoring and some work will be needed to make this a pleasant experience in Light Table. It would be nice to have a drop-down text box show up from a keyboard shortcut or right click menu. We probably want to open all the affected files in the editor with the changes made, but not saved. Not sure what the path of least surprise is just yet.
OS-X 10.10, LT 0.8, TernJS 0.1.10
With any kind of JS project all i get is:
Error: spawn /Applications/lighttable-0.8.1-mac/LightTable.app/Contents/Resources/app/plugins/node/node ENOENT
at exports._errnoException (util.js:837:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:441:9)
at process._tickCallback (node.js:355:17)
Error: channel closed
at ChildProcess.target.send (internal/child_process.js:509:16)
at eval (/Users/fjenett/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:442:16)
at eval (/Users/fjenett/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:277:36)
at eval (/Users/fjenett/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:212:14)
at eval (/Users/fjenett/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:95:18)
at eval (/Users/fjenett/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:111:18)
at FSReqWrap.oncomplete (fs.js:82:15)
Error: spawn
and Error: channel closed
keep repeating over and over again whenever i type anything.
I'm using nvm
as node version manager. Also i can not find any node inside the .app bundle's plugin folder (where it seems to look for it in the error message above).
Any idea how to further debug this?
Add support for sending partial files to the tern server to reduce the lag time when autocompleting on large files.
When requesting doc comments from the server, the comment is returned with all characters (including asterisks) except new lines. While this is helpful, it doesn't display very well. We may need to look into parsing the comment strings our self and formatting the output for the doc display.
I'm running the latest release version of Light Table on Windows 7. I installed the plugin (seemingly). What now?
I tried to view inline docs for a function with a JSDoc-style comment (in the same JavaScript file) but nothing happens (that I can see).
Does Tern need to be installed and setup separately?
Can I use this plugin in a project (workspace) that's not using Node.js or RequireJS?
Hey there. Finally got some time to experiment with this again at work. The good news is that it no longer hangs on the large node client/server stack that was previously causing it trouble. It throws up its hands and gives up on AMD, but that's par for the course even with humans sometimes. ๐ฆ
Unfortunately, it no longer seems capable of finding definitions within the node_modules directory, which is 80% of it's use case for me. When I want documentation on a function or need to jump to its definition, it's almost never in the same app as I'm currently in (as we try to avoid giant monolithic apps). While I agree it shouldn't eagerly parse each module, it would be nice if it could recognize that I asked for information on a node module and parse it then.
Cheers,
Josh
Original discussion can be found at issue #9.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.