lsp-inlayhints.nvim icon indicating copy to clipboard operation
lsp-inlayhints.nvim copied to clipboard

Inlay Hints style like JetBrains Soft

Open NEX-S opened this issue 2 years ago • 11 comments

is there any options can make inlay hints like jetbrains intelij stuff? like in C programming printf("Hello") will become printf(_Format:"Hello")

NEX-S avatar Aug 28 '22 21:08 NEX-S

Btw how to remove the bracket like ( ) around the inlay hints....

NEX-S avatar Aug 28 '22 21:08 NEX-S

is there any options can make inlay hints like jetbrains intelij stuff? like in C programming printf("Hello") will become printf(_Format:"Hello")

We're blocked by anticonceal.

Btw how to remove the bracket like ( ) around the inlay hints....

I'll think about it, do note that this makes easier to differentiate between hints. See also https://github.com/lvimuser/lsp-inlayhints.nvim/pull/13#issuecomment-1221409211.

lvimuser avatar Aug 29 '22 12:08 lvimuser

This is now possible on https://github.com/neovim/neovim/pull/20130 Work will be going on the anticonceal branch.

image

lvimuser avatar Sep 09 '22 15:09 lvimuser

bravo!!!

NEX-S avatar Sep 10 '22 03:09 NEX-S

I got the error today by using the branch mentioned:

image

zsmatrix62 avatar Sep 11 '22 01:09 zsmatrix62

I got the error today by using the branch mentioned:

The PR hasn't landed yet, you have to build neovim from source and manually apply the patch.

lvimuser avatar Sep 11 '22 09:09 lvimuser

actually I'm pulling the latest source code from vim repo and built on myself.

zsmatrix62 avatar Sep 11 '22 10:09 zsmatrix62

actually I'm pulling the latest source code from vim repo and built on myself.

Did you also apply the patch? wget https://patch-diff.githubusercontent.com/raw/neovim/neovim/pull/20130.patch && git apply 20130.patch

lvimuser avatar Sep 11 '22 10:09 lvimuser

actually I'm pulling the latest source code from vim repo and built on myself.

Did you also apply the patch? wget https://patch-diff.githubusercontent.com/raw/neovim/neovim/pull/20130.patch && git apply 20130.patch

It works like charm!! Thanks!

image

zsmatrix62 avatar Sep 12 '22 12:09 zsmatrix62

With clangd, I observe that in the case of nested function call, I see that only inner call has inlay-hints and not the outer call. image

Can this be neovim/treesitter/LSP issue? Can this be address in this plugin?

ratheesh avatar Oct 08 '22 14:10 ratheesh

With clangd, I observe that in the case of nested function call, I see that only inner call has inlay-hints and not the outer call. Can this be neovim/treesitter/LSP issue? Can this be address in this plugin?

Try https://github.com/lvimuser/lsp-inlayhints.nvim/issues/11#issuecomment-1218269707 on the given range and check the output.

lvimuser avatar Oct 11 '22 14:10 lvimuser

applying the patch on current neovim results in errors, I tried to merge it but get errors on compiling

Baehn avatar Dec 29 '22 10:12 Baehn

Awesome, works for me! Looks essentially the same as vscode's inlay hints now. I did have to fix one thing when patching though: the patch includes a call to nonexistent macro STRLEN at src/nvim/drawline.c:1649. I changed that to strlen, and it compiled just fine.

willothy avatar Feb 17 '23 16:02 willothy

Awesome, works for me! Looks essentially the same as vscode's inlay hints now. I did have to fix one thing when patching though: the patch includes a call to nonexistent macro STRLEN at src/nvim/drawline.c:1649. I changed that to strlen, and it compiled just fine.

Hello @willothy , could you please give a sh script from compelling vim to applying the patch ... I'm quite not familiar with the setup ... much appreciated ..

zsmatrix62 avatar Feb 17 '23 17:02 zsmatrix62

@zsmatrix62 Sure! Here's what I did. If you don't want to do it yourself, the "active" branch in my neovim fork is already patched if you just want to clone that.

#!/bin/sh

# Ensure you have basic C tools installed (make, cmake, gcc, etc.)
# Ensure you have the github CLI installed

# clone the neovim repo
gh repo clone neovim/neovim       # or git clone [email protected]:neovim/neovim.git

# cd into project root
cd neovim

# checkout the patch PR

gh pr checkout 20130              # or git checkout a59e09c

# create a new branch with the patch
git checkout -b patch-20130

# checkout the latest nightly neovim
git checkout nightly

# merge the changes from the patch branch
git merge patch-20130

# fix any merge conflicts 
# there should only be some in src/nvim/drawline.c and some in test/functional/ui/decorations_spec.lua
# accept incoming (patch-20130) changes in drawline.c
# accept HEAD (nightly) changes in test/functional/ui/decorations_spec.lua

# before you commit the merge
# go to src/nvim/drawline.c in your editor, find line 1649.
# It should look like this:
#    n_extra = (int)STRLEN(p_extra);
# change it to this:
#    n_extra = (int)strlen(p_extra);

# commit the changes
git add src/nvim/drawline.c
git add test/functional/ui/decorations_spec.lua
git commit -m "Merge inline hints patch"

# Build neovim
make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install

willothy avatar Feb 17 '23 23:02 willothy

@zsmatrix62 Sure! Here's what I did. If you don't want to do it yourself, the "active" branch in my neovim fork is already patched if you just want to clone that.

#!/bin/sh



# Ensure you have basic C tools installed (make, cmake, gcc, etc.)

# Ensure you have the github CLI installed



# clone the neovim repo

gh repo clone neovim/neovim       # or git clone [email protected]:neovim/neovim.git



# cd into project root

cd neovim



# checkout the patch PR



gh pr checkout 20130              # or git checkout a59e09c



# create a new branch with the patch

git checkout -b patch-20130



# checkout the latest nightly neovim

git checkout nightly



# merge the changes from the patch branch

git merge patch-20130



# fix any merge conflicts 

# there should only be some in src/nvim/drawline.c and some in test/functional/ui/decorations_spec.lua

# accept incoming (patch-20130) changes in drawline.c

# accept HEAD (nightly) changes in test/functional/ui/decorations_spec.lua



# before you commit the merge

# go to src/nvim/drawline.c in your editor, find line 1649.

# It should look like this:

#    n_extra = (int)STRLEN(p_extra);

# change it to this:

#    n_extra = (int)strlen(p_extra);



# commit the changes

git add src/nvim/drawline.c

git add test/functional/ui/decorations_spec.lua

git commit -m "Merge inline hints patch"



# Build neovim

make CMAKE_BUILD_TYPE=RelWithDebInfo

sudo make install

Fantastic!thanks!

zsmatrix62 avatar Feb 18 '23 01:02 zsmatrix62

closing in favor of #46

lvimuser avatar May 11 '23 11:05 lvimuser