Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [handly-dev] An LSP Example

Thanks, Vlad!

Best regards,

Cool, Vladimir!

I hope it is okay that I forwarded your message to the lsp4e list.

best regards,

On Fri, Feb 9, 2018 at 3:29 PM, Vladimir Piskarev <pisv@xxxxx> wrote:

Greetings handly-dev,

I have just pushed to master a new exemplary implementation called "LSP Example".

The LSP example (org.eclipse.handly.examples.lsp) demonstrates a Handly-based model that can represent in a generic way any LSP-based source file. It is built on top of Eclipse LSP4J.

For information about LSP, see

Implementation note. Currently, we use symbol location range to infer a hierarchy for a given flat list of symbols in a text document, just as Eclipse LSP4E does in its SymbolModel. However, according to a recent revision of the LSP specification
"The range doesn't have to denote a node range in the sense of an abstract syntax tree. It can therefore not be used to re-construct a hierarchy of the symbols."
It appears that, for the time being, there is no protocol defined way in LSP for building a tree of symbols [1]. Since the approach we currently use clearly violates the specification, it may or may not work, depending on a language server implementation.

I hope that the value of this example goes beyond demonstrating a possible way of integration with LSP. First, the example stands on it own in that it shows a rather unusual Handly-based model without a single root element: in this model each source file is the root of a separate element tree. Second, the example goes beyond LSP because it is more about a certain architectural style than the specifics of LSP: you could use a similar approach with a custom "server protocol", for example.

A goal was to keep the example rather simple. However, it would be not too hard to expand upon it and implement a more functional standard interface for the source file (in line with the basic feature set provided by LSP), make the model pluggable (so plug-ins could contribute their own implementations of source files for a language to the common model through an extension point), or even grow the code into something production-ready (provided that LSP specifies an appropriate way to build an element tree) as an integration layer in Handly and/or a part of LSP4E if there is sufficient interest. Preferably, any of these or other enhancements should happen in a community-driven way, patches would be most welcome. It is open-source, after all ;-)


handly-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top