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

OpenSCAD Language Server #16

Closed
Tomatower opened this issue Feb 7, 2021 · 3 comments · Fixed by #17
Closed

OpenSCAD Language Server #16

Tomatower opened this issue Feb 7, 2021 · 3 comments · Fixed by #17

Comments

@Tomatower
Copy link
Collaborator

I have started implementing the Language Server Protocol interface for OpenSCAD, and I would love to see it used in the already best vscode extension for openscad: openscad/openscad#3635
The Idea is, that we can start openscad --lsp-listen 23725, connect to port 23725, and vscode-languageclient takes care of all the fancyness.

I have created a super minimal extension for the basic support, which will grow with the openscad interface (for example "hover", autocomplete with defined module names, ...). I have already planned to add a bunch of features.
You can find my extension here: https://github.com/Tomatower/vscode-openscad

The biggest change to this extension would be openscad.render will change, and some logic that has to check if the currently running version does support LSP.

Do you want to have a PR for this upgrade?

@Antyos
Copy link
Owner

Antyos commented Feb 8, 2021

Do you want to have a PR for this upgrade?

Absolutely. I am totally on board with this.

I have been wanting to implement a language server for a while, but haven't had the chance. I am absolutely delighted to see someone asking about wanting to add one as a PR! Let's make this work!

I do have one question/concern--with openscad/opendscad#3635, does that mean the language server will only work in a future version of OpenSCAD (assuming the feature is merged)? Or, will the language server still be able to work in older versions of OpenSCAD. My main hesitation is that this feature won't be available for months or only for users of experimental builds, though I suppose that's more a matter of patience than anything else.

Also, how are you planning to work on the language server? I mainly ask because your extension repo is not a fork of this one. Are you planning on creating it for this extension or are you creating a general language server extension? If it's the former, I think it would be easiest to develop the server on a fork of this codebase. If not, we can find some way to bundle them together. There are pros and cons to both options.

@Tomatower
Copy link
Collaborator Author

It is very likely to get merged, in the next couple of weeks.

Unfortunately, this is exactly what that means. The Languageserver is integrated into OpenSCAD, enabling us to trigger previews from vscode and whatever random Ideas we come up with (related to #6, but also on non-dbus systems.)

The language server will be only in the experimental builds, and it will take a few months until the next release of openscad (the last one was a week ago.)
But the latest experimental version can be packaged with this extension or download it on request.

My "extension" is only like ~90 lines of code, which I will integrate as a fork from this repo. (see https://github.com/Tomatower/vscode-openscad/blob/master/client/src/extension.ts - the rest is the remainder of the lsp-sample project)

@Antyos
Copy link
Owner

Antyos commented Feb 9, 2021

Alright, sounds good!

If we want to bundle a preview version with the extension, I'll need to change the license from LGPL3 to GPL3 (which I've been meaning to do for some time now).

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

Successfully merging a pull request may close this issue.

2 participants