gnolang / hackerspace

Tinker, build, explore Gno - without the monorepo!
7 stars 4 forks source link

`gnols`: A Language Server for Gno! #34

Open jdkato opened 10 months ago

jdkato commented 10 months ago

Hi, everyone!

I’m a big fan of Go and I’m looking to get more involved in the web3 space, so naturally I found the Gno project.

While getting acquainted, I realized that there were IDE-like features that I missed when working on Gno files (especially with being unfamiliar with the standard library).

I saw Gno for VS Code, which is a great start, but I’m a Sublime Text / Neovim user.

So, I figured I’d experiment with an LSP implementation—gnols. The ultimate goal is to make these features available to all contributors regardless of editor preference.

It’s still very much experimental (about 2 days of work), but I thought I’d share my progress here.

I’m going to be working on tutorials for getting this set up, starting with Sublime Text and Neovim.


Hover Tooltips Autocomplete
In-editor documentation for all exported symbols in the Gno standard library. Autocomplete for all exported symbols in the Gno standard library.
Diagnostics Formatting
Real-time precompile & build errors in your Gno files. Format Gno files with the tool of your choice.
thehowl commented 10 months ago

This is incredible work! :heart_eyes:

I've also painfully felt the lack of autocompletion and linting as I spent the past week working on a semi-complex realm :) I look forward to your neovim tutorial!

We had some previous discussion on #5 about potentially creating a fs.FS "compatibility layer" between Gno and Go tools. Just referring to that for context, because whatever it is you're doing, if you can get my editor to autocomplete my Gno code in 2 days, I trust what you're doing, magic man.

MichaelFrazzy commented 10 months ago

Wanted to second @thehowl by saying this is great, thank you! I'm still slowly getting used to Go/Gno vs other languages and this would make that process more straightforward for me as well.

tbruyelle commented 10 months ago

This is awesome, this is something I wanted to work on but never found the time and motivation to do it :) I have an implementation question, did you fork gopls or start from scratch?

jdkato commented 10 months ago

I have an implementation question, did you fork gopls or start from scratch?

It's "from scratch" but still very early. It does feel like being able to make use of the existing ecosystem is ultimately the way to go.

For now, though, my goal is to provide an experience similar to "Gno for VS Code" (running tests, syntax highlighting, formatting) + basic intellisense in other editors.

ilgooz commented 10 months ago

@jeronimoalbi

tbruyelle commented 10 months ago

It's "from scratch" but still very early. It does feel like being able to make use of the existing ecosystem is ultimately the way to go.

For now, though, my goal is to provide an experience similar to "Gno for VS Code" (running tests, syntax highlighting, formatting) + basic intellisense in other editors.

Impressive, I know there is/was a dedicated go team for coding gopls, and I followed a little bit their work, it didn't seem like a small task!

jdkato commented 10 months ago

Quick update here:

moul commented 9 months ago

By the way, was it intentional to name it gnols rather than gnopls?

jdkato commented 9 months ago

I went with gnols to simply mean "Gno Language Server." I thought that gnopls might more strongly imply an expectation (or intent to) to match the functionality of gopls, which it's not close to.

jdkato commented 9 months ago

Another update: I've written tutorials for Sublime Text and Neovim. GoLand released support for an LSP API fairly recently, so I'm going to look into that next.

tbruyelle commented 9 months ago

I went with gnols to simply mean "Gno Language Server." I thought that gnopls might more strongly imply an expectation (or intent to) to match the functionality of gopls, which it's not close to.

@jdkato Out of curiosity, what gopls has more than just a LSP implementation ?

jdkato commented 9 months ago

Out of curiosity, what gopls has more than just a LSP implementation ?

Not necessarily "more" than an LSP implementation, but it's much more spec-complete in terms of offering features like navigation and refactoring. The name is really not something I feel strongly about, though :)