Sublime Forum

LSP: Universal language server plugin

#10

It looks like you have an older version of python-language-service installed, as _check_in_workspace disappeared in the (latest) release 0.4.1. Could you update and try again?

1 Like

#11

I quickly called pip install without -U flag yesterday, but wasn’t aware of it not to call an upgrade of existing packages.

Works like a charm now.

One tip: You might want to disable sublime’s default "show_definitions" setting for views handled by the LSP in order to avoid popup fighting.

I am really happy to see this plugin. I was looking for some approaches of language servers for ST again and again. It will enable ST to support nearly any language in the future without the need to create dedicated language packages for ST. Really cool.

0 Likes

#12

I tried hooking up Go with https://github.com/sourcegraph/go-langserver

Find Symbol References and Go to Symbol Definition work fairly well. Though, the autocompletion is flakey (especially non-stdlib) and the go-langserver process is chewing major CPU!

0 Likes

#13

@tomv564 The commands offered in the right-click menu seem like they should be based on where the mouse cursor is rather than where the text input caret is

0 Likes

#14

Glad you like it, agree about show_definitions (created an issue: https://github.com/tomv564/LSP/issues/9)

About dedicated language packages, they are often impressively complete and specialised. I hope we can get “good enough” language support with a consistent user experience with LSP, instead of covering all the nice-to-haves/quirks of each language.

0 Likes

#15

How does this differ from https://github.com/sourcegraph/sublime-lsp?

0 Likes

#16

Having to primary-click before opening the context menu was always a major annoyance.

It should be fixed now, along with the Code Actions context menu item.

Thanks for the feedback!

1 Like

#17

Sublime-lsp is a fork of Microsoft’s (excellent, IMO) Typescript plugin. It was a clever way to get a polished package up and running quickly, but there is a lot of Typescript baggage left in the implementation.

By now, I believe LSP has a more complete implementation of the LSP protocol, and has been tested against more language servers.

There appears to be little effort going into sublime-lsp from sourcegraph or other volunteers since Nov 2016.

1 Like

#18

Great work! I’ll check it out soon with PHP, Python and JavaScript.

In the mean time, I’ve created a pull request to list it on the LSP page.

0 Likes

#19

Awesome, thanks for submitting it there!
I haven’t tried the PHP language server yet, curious how it works!

0 Likes

#20

Should I replace https://github.com/Microsoft/TypeScript-Sublime-Plugin with this plugin?

0 Likes

#21

If you’re happy with Microsoft’s Typescript package I would hesitate to switch - for Typescript development it is more complete and stable than this LSP package.

LSP does offer code actions which Microsoft’s package does no have. I also use this package often for typescript development, so it is likely to improve in the future!

1 Like

#22

Thanks to many bug reports and contributions, version 0.2.0 was released this week.
Significant improvements were made in diagnostics handling and completions.

The update notes are on Github.

Besides Python and Javascript/Typescript we’ve had users try it with Clangd, Flow, PHP and OCaml/Reason!

6 Likes

#23

Hey Tom, thanks for the client, I would love to set it up for Java. I couldn’t find an example to get this done. I think the server is: https://github.com/eclipse/eclipse.jdt.ls based on http://langserver.org/

Would it be possible to get the client to connect for Java? If so, do you have a set of steps to follow?

0 Likes

#24

Hi Arin,

I haven’t seen reports of other people using the java language server yet. It is in use in the Atom IDE project and sounds like a complete implementation.

The installation steps for eclipse.jdt.ls sound a bit Eclipse-focused. Atom’s ide-java package provides some of the details you need (see their code here: https://github.com/atom/ide-java/blob/master/lib/main.js)

Download and uncompress this package

Try launching it manually first (see “command” below, or the ide-java code).
Be sure to set the config parameter to the relevant “config_win/”, “config_mac/” or “config_linux/” path within the language server you unpacked.

The LSP client config (add to your LSP Settings) should then look approximately like this:

"jdtls": {
	"command": ["java", "-jar", "PATH_TO_JDT_SERVER/plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar", "-configuration", "PATH_TO_CONFIG_DIR"],
	"scopes": ["source.java"],
	"syntaxes": ["Packages/Java/Java.sublime-syntax"],
	"languageId": "java"
},

I’m keen to get documentation and default config for this added to the LSP project, please feel free to share your findings on GitHub! (https://github.com/tomv564/LSP)

1 Like

#25

We’ve accumulated features and fixes from 8 contributors over the last 2 weeks.
Time for another release: 0.2.1 on Package Control.

Besides Go, the package has been tested with the Julia and OCaml language servers (including the Reason language)

Release notes are here: https://github.com/tomv564/LSP/releases/tag/0.2.1

3 Likes

#26

This is really exciting! PHP support doesn’t seem to work, but I’ll see if I can help fix it.

0 Likes

#27

@tomv564 I’m using this with the jsts server and the thing I’m constantly running into is that it doesn’t pick up changes to type definitions/imports. I’m not sure if that’s something LSP should do, or if it’s the server… My current solution is to restart the server and then trigger it to run my file again by adding and removing some lines and then saving. Two questions:

  • do I open an issue for LSP or for the jsts server?
  • is there a clean way of clearing a server’s state and running the diagnostics again for a file?
0 Likes

#28

I suggest you open an issue for the javascript/typescript server, and it would be likelier to be fixed if you could narrow down a minimal reproduction.

Another case that the javascript/typescript server does not support is changes outside the editor (eg. git checkout another-branch). There is an API for this (DidChangeWatchedFiles), but I haven’t seen many implementations of this yet.

Restart server is a bit of a hack - it should be sending a didOpen for the document you were in, then you would get the diagnostics without the change. That could be a good suggestion for LSP.

0 Likes

#29

Thanks! My most common case is with type defs that are generated, we work with loads of code and api generation that we type-check against, and that’s always a process outside the editor that updates the imports. So that mostly with jsts then.

0 Likes