Hi Jan,

I was hoping you'd chime in.

> I think it would be good to avoid having LSP4J classes in the API

I agree, but designing such an API would be too much a task for me I think
(I'm too new to NetBeans innards).
>From the cursory look I took, I don't think I can just minimally expose
some API, because I'd need access to the LSPBinding and the
WorkspaceService.
It's probably best to give it more thought about what an extensible API for
LSP clients could look like.

> Also, I wonder why the server needs a command to start working - should
not
> be that done automatically? (Does it really require all LSP clients to be
> modified to send it a command? Seems to be against the purpose of the
> protocol.)

I can more or less answer this. Their LSP server does a bit more than just
language support by also interfacing with the BSP server [1], at the same
time, because of the limitations of what has been standardize so far in
LSP, they have several extensions that you wouldn't be able to leverage via
generic protocol.
So a text-editor integrating with Metals is expected to run some workspace
commands to guide it [2].

In some ideal world scenario for my case (the Scala LSP integration), I'd
integrate with the BSP server myself, but for now Metals (that's the name
of the Scala LSP server) takes care of that.

[1] https://github.com/scalacenter/bsp/blob/master/docs/bsp.md
[2]
https://scalameta.org/metals/docs/integrations/new-editor.html#metals-server-commands


On Tue, Nov 24, 2020 at 5:05 PM Jan Lahoda <lah...@gmail.com> wrote:

> FWIW, for an API, I think it would be good to avoid having LSP4J classes in
> the API. So that we can replace the library that handles the communication
> if we need/want without breaking clients.
>
> Also, I wonder why the server needs a command to start working - should not
> be that done automatically? (Does it really require all LSP clients to be
> modified to send it a command? Seems to be against the purpose of the
> protocol.)
>
> Anyway - having a way to run a (registered) command would sound great to
> me!
>
> Jan
>
>
> On Tue, Nov 24, 2020 at 2:46 PM Randamuna Namae <ioniv...@gmail.com>
> wrote:
>
> > Alright, will do.
> >
> > Thanks.
> >
> > On Tue, Nov 24, 2020 at 8:58 AM Jaroslav Tulach <
> jaroslav.tul...@gmail.com
> > >
> > wrote:
> >
> > > Dne úterý 24. listopadu 2020 1:15:19 CET, Randamuna Namae napsal(a):
> > > > Hello dear community,
> > > >
> > > > I'm working on integrating Apache NetBeans with Scala's LSP server
> and
> > > got
> > > > the basics working.
> > >
> > > That's great! Recently I needed to work with scala code (https://
> > > renaissance.dev/ benchmark) and the old Scala support in NetBeans 8.x
> is
> > > no
> > > longer very reliable.
> > >
> > > > it seems that calling a command programmatically
> > > > wont be possible after all since the LSP classes are module private.
> > > > Is there a workaround for this?
> > >
> > > Prepare a PR that opens up the API slightly and let Jan Lahoda review
> it.
> > > -jt
> > >
> > >
> > >
> > >
> >
>

Reply via email to