Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect tern.java to an external user installed, user managed, tern server #142

Closed
MetaMemoryT opened this issue Oct 10, 2014 · 8 comments
Closed

Comments

@MetaMemoryT
Copy link

This is a very simple solution to issues such as #43 #141

The Problem

Power users and developers are often creating their own tern modules/defs/plugins and hand edit .tern-project files with complex additions that the gui does not support. For example, the plugin tern-closure supports custom "finder" attributes (look here for more information):

{
  "plugins": {
    "doc_comment": false,
    "closure": {
      "finder": {
        "name": "grep",
        "dirs": [
          "relevant/project/subdir",
          "/absolute/path/to/library"
        ]
      }
    }
  }
}

The gui will always lag behind what the plugins support, so here is a proposal enabling "power users" to work on the bleeding edge (forked tern server, forked plugins, etc) with little hassle and easily debug the tern server.

The Eclipse Interface

In the eclipse gui, on the project properties, under Tern panel, there would be 2 new options:

use external tern process: [true / false] (default to false)
port of external tern process: [port number]

And 1 new button:

[Connect to external tern server]

The New Way to use Tern.java

The new workflow of a "power user"/plugin developer would be to:

  1. Hand edit a .tern-project file in the project root.

  2. Ensure all plugins/modules/defs are in the correct paths for the next step. The power user can retrieve them any way they want, npm install, etc.

  3. Manually start the tern server with any special args, custom PATH, desired. (type in on the command line):

    cd eclipse-workspace/<project-root>/
    tern
    
  4. click the button [Connect to external tern server] under the eclipse project properties, on tern panel
    If the connection failed, an eclipse dialog would pop up "Cannot connect to tern server on port "

Benefits and Conclusion

This would allow the continuation of development of an "integrated tern" while power users / developers could benefit / test their newly created features before the next tern.java release.

The external tern would not be managed by eclipse, it would not automatically shutdown, etc. That is all left up to the developer to manage from the command line, for each individual project he wants to have tern support for.

This would make tern much easier to debug, because someone could install tern and then:

node-debug tern

and use node-inspector to "break on exceptions" when they did some behavior in eclipse that caused tern to create an error.

I found node-inspector much nicer that eclipse v8 debugging, because it has simple "live editing" with no annoying "virtual project files" (what I want is this Nodeclipse/nodeclipse#157) and you can set breakpoints in it easier, and the breakpoints persist automatically between sessions, compared to eclipse you have to import/export them every debug launch.

This new system would also fix one other issue, if the "use external tern process: " is checked, tern.java would never touch the .tern-project file, (because if you are hand editing it, you do not want it minified, or tern.java overwriting it.) Some projects (like tern itself) contain a hand edited .tern-project, and when imported into tern.java, tern.java automatically overwrites it, creating a git file change you don't want to commit to the main project.

@angelozerr
Copy link
Owner

For example, the plugin tern-closure supports custom "finder" attributes

Yes I know, I have integrated tern-closure https://github.com/angelozerr/tern.java/wiki/Tern-&-Closure-support and you have an UI options to manage JSON dirs.

use external tern process: [true / false](default to false)

You mean use a tern folder which contains plugins, defs and other tern-* plugins? If it that I had created aon issue for that #30

port of external tern process: [port number]

Is it that https://github.com/angelozerr/tern.java/wiki/New-and-Noteworthy-0.4.0#user-content-nodejs-remotedirect-access ?

Hand edit a .tern-project file in the project root.

It means that we must observe the changes of this file to reload the JSON IDETernProject.

Manually start the tern server with any special args, custom PATH, desired

yes it was my idea to debug with breakpoint tern plugin with nodeclipse. See https://github.com/angelozerr/tern.java/wiki/Debugging-tern.js-with-Nodeclipse

I think we have the same idea, but I would like to manage 2 cases :

1.1 generate a tern plugin with the existing wizard "Server Plugins" https://github.com/angelozerr/tern.java/wiki/Tern-Toolings inside the root project (next to .tern-project)
1.2 add in the Modules UI a button called "Add Module", to add a module inside .tern-project

  1. like you suggest, configure a tern repository that you can create with npm. This tern repository can be used with direct/remote access.

@angelozerr
Copy link
Owner

@MetaMemoryT please read https://github.com/angelozerr/tern.java/wiki/Tern-Toolings-Server-Plugins it's the first step to use custom tern plugin (inside root project)?

@MetaMemoryT
Copy link
Author

Thanks for all the information. I am currently thinking of using a different editor than eclipse because of JSDT's lack of support for es6, (nothing to do directly about this project.). You can close this if you think everything has been addressed.

@angelozerr
Copy link
Owner

I am currently thinking of using a different editor than eclipse because of JSDT's lack of support for es6

That's shame for tern.java -( Are you tried to create bugzilla for your need? What do you need about es6? Do you think tern.java could support your need?

You can close this if you think everything has been addressed.

I have not finished. I will close it when I will finish it.

angelozerr added a commit that referenced this issue Oct 19, 2014
@angelozerr
Copy link
Owner

@MetaMemoryT if you are interested please install 0.7.0 SNAPSHOT version of tern.java http://oss.opensagres.fr/tern.repository/0.7.0-SNAPSHOT/

Now you can customize your tern repository like you wished

ternrepository

After clicking on OK button, you can reopen the Tern -> Modules and you will see the modules of your custom tern repository. Hope you will like it.

@paulvi
Copy link
Contributor

paulvi commented Jan 4, 2015

different editor than eclipse because of JSDT's lack of support for es6

That is https://bugs.eclipse.org/bugs/show_bug.cgi?id=223131

@paulvi
Copy link
Contributor

paulvi commented Aug 17, 2015

Isn't this done?

@angelozerr
Copy link
Owner

Yes you are right, I close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants