CircleCI-Public / circleci-yaml-language-server

The official language server for CircleCI YAML configuration files
Apache License 2.0
20 stars 18 forks source link

Neovim - can't get the more advanced features working #283

Closed tomoakley closed 7 months ago

tomoakley commented 7 months ago

Hi, l've been working on a circleci plugin for neovim, inspired by your vscode plugin. I've added support for the LSP, which attaches to the buffer and is able to do some syntax highlighting, go-to-definition and find references. But the more advanced features you list in the readme don't appear to work, or I'm not sure what I need to do to get them to work, such as:

The syntax highlighting appears to work, although if I start typing a new line, before I've finished it will change all of the text across the buffer to white. When I make the line valid yaml (e.g add a ':'), the syntax highlighting will kick in again. I'm assuming I've implemented it wrong - the implementation in my plugin is here https://github.com/tomoakley/circleci.nvim/blob/main/lua/nvim-circleci/lsp.lua.

Would be very appreciative if anyone who knows Neovim/Lua could tell me what I've done wrong (I'm a bit of a newbie to writing plugins for neovim and handrolling LSP etc)

JulesFaucherre commented 7 months ago

Hey @tomoakley

Thanks a lot for the contribution!! That's really appreciable! On your problem, a lot of the LS features won't work because the LS needs to be passed few other assets. It is not documented so we'll make sure to add the doc here. I'll try to answer your three points here.

Again, thanks for the great work you're doing! If there is anything else I can do to help please tell me!

Side note: I'm also working on making an CCI NVim pipeline viewer on my free time, I wanted to go for the LS configuration so I can fully appreciate the work you put there 😄 !

tomoakley commented 7 months ago

Hi @JulesFaucherre! Thanks for the detailed reply. I have updated the path to the schema.json in the -schema flag which has made the syntax highlighting, autocomplete and syntax validation/usage warnings work correctly. Thanks for pointing out my error! I will look at setting the user token for private orbs/contexts and see if it would be possible to implement the hover feature.

JulesFaucherre commented 7 months ago

Glad to hear that, again, don't hesitate if you have any other question!

JulesFaucherre commented 7 months ago

FYI @tomoakley , I just referenced your plugin in the README as one of the clients of the Language Server.

tomoakley commented 7 months ago

FYI @tomoakley , I just referenced your plugin in the README as one of the clients of the Language Server.

awesome thanks! Although I think you may have put the wrong link 😅

Screenshot 2024-04-02 at 15 43 21
JulesFaucherre commented 7 months ago

Damn my bad 😅 , that's edited

JulesFaucherre commented 7 months ago

By the way I also added a page of doc to help other people that would want to implement other LS client. Don't hesitate to look at it here and if you have any thing you think would be worth mentioning in the page please tell !

tomoakley commented 7 months ago

By the way I also added a page of doc to help other people that would want to implement other LS client. Don't hesitate to look at it here and if you have any thing you think would be worth mentioning in the page please tell !

will have a think, thanks. Just fyi, I managed to get contextual documentation working - had to implement yaml-language-server and set schemas to download the circle schema. https://github.com/tomoakley/circleci.nvim/pull/9 - was much easier than I thought!