-
-
Notifications
You must be signed in to change notification settings - Fork 777
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
Lsp/inlay hints on pipe #3290
base: main
Are you sure you want to change the base?
Lsp/inlay hints on pipe #3290
Conversation
Hi @lpil the PR is almost ready for review. If not, could we consider merging the PR (once it's reviewed) as dead code? (e.g. setting the |
64afe96
to
9f46fff
Compare
How would the programmer turn it on in this case? I think they need to be able to turn it on and add as needed in a straightforward fashion. |
It wouldn't be possible. What I was proposing was either:
Otherwise I can just try to implement the config part in this PR |
697960d
to
2d52e9e
Compare
9ed02ef
to
7894a79
Compare
@lpil I think that should be it 🙂 |
fe20ce7
to
7894a79
Compare
@lpil I've updated the PR with the description of how to turn the feature on. In general, it requires setting to Depending on the editor, there could be ways to turn it on momentarily (e.g. with a keyboard shortcut) if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, '[T]oggle Inlay [H]ints')
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! Thank you very much for waiting too, I've nearly got through all the compiler PRs 😅
|
||
fn configuration_update_received(&mut self, result: serde_json::Value) -> Next { | ||
let Some(first_el) = result.as_array().and_then(|a| a.first()) else { | ||
return Next::MorePlease; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be an error?
} | ||
|
||
fn response(&mut self, response: lsp_server::Response) -> Next { | ||
if let Some(handler) = self.response_handlers.remove(&response.id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would it be valid for there to be a response that we don't have a handler for? Or there being a handler but no result in the response?
Sorry for keeping it open for a long time; I had less time recently but I might able to make it to the finish line in the following days |
e6b80fd
to
9824c74
Compare
Hello! Sorry, just catch up after my holiday. Is this ready for review? |
Hi Louis, sorry about the wait - I have been a little busy too. There are still a couple of things missing but I should be able to take care of them this week |
db11626
to
f14e019
Compare
Hey @lpil everything should be good to go, except for this couple of bits where I am not sure how to handle error within gleam/compiler-core/src/language_server/messages.rs Lines 253 to 257 in 8b63e33
gleam/compiler-core/src/language_server/messages.rs Lines 271 to 280 in 8b63e33
Should I add a new variant to the |
8b63e33
to
2966da4
Compare
@lpil Hello! Any news? |
FYI merge commits are not allowed in this repo. You'll need to rebase instead before this will be merged. (Not sure why checks are passing, they should catch merge commits) |
Thanks! Will fix it ASAP |
4fdf1bc
to
5d39782
Compare
5d39782
to
cda542c
Compare
Implements #3291
This PR shows inlay hints with the type of a pipeline step (only for pipeline expressions that span across multiple lines). Hints won't be shown for literal values (ints, floats, strings, bitstrings
The functionality is toggled via the
gleam.inlayHints.pipelines
client config optionThe PR is meant to be read as a whole (not commit by commit - however the config functionality is implemented in a single commit: 9e12629)
Here's the vscode client PR: gleam-lang/vscode-gleam#82
How to activate hints
Vscode
Once the vscode client pr is merged, it will be possible to toggle the option via the vscode settings
Sublime text
The user will need to enable the functionality in the settings of the LSP sublime extension:
Nvim
The user will need to enable the functionality in the
init.lua
file:Future development
Credits
The part of the pr about config is partially based upon this previous pr #2393