Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[orion-dev] Using Docker to test Orion's LSP support...

Hi all,

For the past month or two I've been toiling over Docker, Orion, the
Java LSP server, and the language server protocol. After some
investigations, I began working on a language server for Dockerfiles.
It's licensed under MIT and is on GitHub if anyone fancies a gander.

https://github.com/rcjsuen/dockerfile-language-server-nodejs

Anyway, since the end goal of Orion's LSP support is to obviously
connect to more than just the Java LSP server, I did some poking and
hacking and got it to connect to my Dockerfile language server.

If anyone wants to give it a try, you can follow these (hopefully)
simple steps below. And don't worry about setting up and downloading
random dependencies. You can try it out with just a browser thanks to
play-with-docker.com!

----------------------

1. Go to play-with-docker.com and start a session. Of course, you can
also do this on your own Docker instance or just clone my branch and
npm install yourself and so on. Whatever works for you.

2. > vim Dockerfile

3. Copy/paste the following content.

----------------------

FROM node:6

RUN mkdir /opt/orion && \
git clone --depth 1 -b docker-lsp
https://github.com/rcjsuen/orion.client.git /opt/orion && \
cd /opt/orion/modules/orionode && \
npm install && \
npm install dockerfile-language-server-nodejs
EXPOSE 8081

CMD [ "node", "/opt/orion/modules/orionode/server.js", "-w", "/opt/orion" ]

----------------------

4. > docker build -t orion/docker-lsp .

5. Alt+Tab and do real work. Shouldn't take that long.

6. Alt+Tab back when you want to play.

7. > docker run -d -p 0.0.0.0:8081:8081 orion/docker-lsp

8. After the container has started, you should see an 8081 link at the
top of your play-with-docker.com page. Open it in a new tab.

9. You now have Orion running and pointing at the cloned orion.client
repository.

10. Create a Dockerfile and have fun!

----------------------

Working features in Orion LSP:
- formatting
- open declaration (for build stage names and ARG/ENV variables)
- read/write mark occurrences highlighting (for build stage names and
ARG/ENV variables)
- hovers (instructions and ARG/ENV variable values)
- warnings/error markers (try typing in non-existent instructions or
writing instructions in lowercase)
- code completion (often gets into hiccups and doesn't suggest
anything, but basically the same as what's in Orion 15.0 right now so
perhaps not that exciting)
- outline with Ctrl+O

Missing features in Orion LSP:
- rename (for build stage names and ARG/ENV variables)
- quick fixes via code actions
- and some other stuff that my Dockerfile server doesn't actually
support like code lens and so on

----------------------

Doing testing with both the Java LSP server and my Dockerfile LSP
server has been great as I've been able to find various little bugs in
Orion's LSP client implementation due to Orion not conforming to the
spec enough.

With some small tweaks I imagine you can reuse my Orion Node IPC
bridge code (that I've almost directly copy/pasted from Olivier's Java
server bridge code) to connect to other language servers written with
the vscode-languageserver node module.

Feel free to let me know if you have any questions or comments. I also
hang out on the Eclipse Mattermost server on the Orion and
eclipse.jdt.ls channels if you want to reach out to me there.

Regards,
Remy


Back to the top