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

Inlay Hints showing in-between text in helix editor #2660

Open
Cyberphinx opened this issue May 21, 2024 · 13 comments
Open

Inlay Hints showing in-between text in helix editor #2660

Cyberphinx opened this issue May 21, 2024 · 13 comments

Comments

@Cyberphinx
Copy link

Cyberphinx commented May 21, 2024

phpactor version: Phpactor 2024.03.09.0@92eb89603c1af3e7b55cedc34ea70945dbfaec0a
operating system: Ubuntu 22.04.4 LTS
code editor: Helix
terminal: Alacritty
shell: Fish
terminal multiplexer: Zellij
project: Laravel app
.phpactor.json:

{
    "language_server_worse_reflection.inlay_hints.enable": true,
    "language_server_worse_reflection.inlay_hints.types": true,
    "language_server_worse_reflection.inlay_hints.params": true,
    "language_server_phpstan.enabled": true,
    "php_code_sniffer.enabled": true
}

phpactor status:

Version: 2024.03.09.0
Filesystems: git, simple, composer
Working directory: /home/user/sites/website

Config files (missing is not bad):

  ✘ /home/user/.config/phpactor/phpactor.json
  ✘ /home/user/.config/phpactor/phpactor.yml
  ✔ /home/user/sites/sta-supplies-ltd/.phpactor.json
  ✘ /home/user/sites/sta-supplies-ltd/.phpactor.yml

Diagnostics:

  ✔ Composer detected - Phpactor could work faster without an index
  ✔ Git detected - enables faster refactorings in your repository scope!
  ✔ XDebug is disabled. XDebug has a negative effect on performance.

helix lsp configuration:

Configured language servers:
  ✓ intelephense: /usr/local/bin/intelephense
  ✓ phpactor: /home/user/.local/bin/phpactor
  ✓ efm-langserver: /usr/bin/efm-langserver
  ✓ tailwindcss-language-server: /usr/local/bin/tailwindcss-language-server
Configured debug adapter: None
Configured formatter: None
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓

issue: the inlay hints are appearing in-between the first character of a text and the rest of the text from its second character.

image

@dantleech
Copy link
Collaborator

dantleech commented May 21, 2024

Probably because we provide the "start" position of the node:

position: PositionConverter::intByteOffsetToPosition($node->getStartPosition(), $node->getFileContents()),

In Neovim the hints show to the right of the line regardless, which is why I haven't noticed this:

image

I guess the issue is that the start poisition in your example is off by one?

happy to accept an PR to fix the behavior.

@zackAJ
Copy link

zackAJ commented May 28, 2024

This should be an issue
same problem here, using neovim, always off by one position but not just that:
when renaming a symbol it renames it with the off selection
image
image

@zackAJ
Copy link

zackAJ commented May 28, 2024

@Cyberphinx did this make it to issues? Also did u find any workaround this bug ?

@dantleech
Copy link
Collaborator

@zackAJ this is an issue? just FYI: I don't get this behavior when renaming and the inlay hints work fine for me in neovim...

@zackAJ
Copy link

zackAJ commented May 28, 2024

@zackAJ this is an issue? just FYI: I don't get this behavior when renaming and the inlay hints work fine for me in neovim...

Well I don't have much going on in my config, pretty fresh installation (kickstart) + only phpactor as an lsp.

What do you suggest, should I do to experiment around ?

@dantleech
Copy link
Collaborator

Restarting VIM but assume you did that, how did you install Phpactor?

@zackAJ
Copy link

zackAJ commented May 28, 2024

Restarting VIM but assume you did that, how did you install Phpactor?

Client via Mason, and then added minimal setup function to my config.

@Cyberphinx
Copy link
Author

The inlay hints are now in correct position when opening the same file in neovim (NVIM v0.11.0-dev) with below lsp config for phpactor. Interestingly, after closing neovim and re-opening helix, the inlay hints appear in correct position in helix.

phpactor = {
          settings = {
            phpactor = {
              inlayHints = {
                enable = true,
                parameterHints = true,
                typeHints = true,
              },
            },
          },
        },

@scippio
Copy link

scippio commented May 29, 2024

Same problem here. Installed via Mason in v0.10.0 neovim.

@zackAJ
Copy link

zackAJ commented May 29, 2024

I still have the problem in Installed via Mason in v0.10.0 Neovim, tried the following configs:

phpactor = {
	cmd = { "phpactor", "language-server" },
	filetypes = { "php" },
	settings = {
		phpactor = {
			language_server_phpstan = { enabled = false },
			language_server_psalm = { enabled = false },
		},
	},
}
phpactor = {
	cmd = { "phpactor", "language-server" },
	filetypes = { "php" },
	settings = {
		phpactor = {
			language_server_phpstan = { enabled = true },
			language_server_psalm = { enabled = true },
		},
	},
}
phpactor = {
	cmd = { "phpactor", "language-server" },
	filetypes = { "php" },
	settings = {
		phpactor = {
			language_server_phpstan = { enabled = true },
			language_server_psalm = { enabled = true },
			inlayHints = {
				enable = true,
				parameterHints = true,
				typeHints = true,
			},
		},
	},
}

@Cyberphinx
Copy link
Author

This issues has appeared again after updating/reinstalling php8.2 and some extensions, such as xmlwriter/simplexml.

@dantleech
Copy link
Collaborator

you mean the issue went away and came back?

@Cyberphinx
Copy link
Author

you mean the issue went away and came back?

Yes it went away and came back

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

No branches or pull requests

4 participants