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

force send request inlayhint message as user defined #779

Conversation

getong
Copy link
Contributor

@getong getong commented Nov 14, 2023

我现在是手动开启发送inlayhint信息的,也就是 self.inlay_hint_provider = True , 不够智能。

lsp-bridge有个选项 lsp-bridge-enable-inlay-hint , 不管lsp-server返回inlayhint能力信息,根据 lsp-bridge-enable-inlay-hint 强制发送请求inlayhint信息。

这样的话,就可以做到了不需要手动修改底层代码,而且由用户配置发送请求inlayhint信息。

@manateelazycat
Copy link
Owner

从我读取的LSP协议, lsp server 必须在回复 lsp client init 消息的时候返回的 capability 消息里面包括 inlayHintProvider 字段才能证明 lsp server 具备 inlay hint 的能力的, 这时候发送给 lsp server inlay hint 请求才是有意义的。

如果按照补丁的改动, 虽然你可以强制从 elisp 读取变量去强制发送 inlay hint 请求, 但是遇到很多并不支持 inlay hint 能力的 lsp server, 发送 lsp server 不具备能力的请求会导致 lsp server 返回错误。

@getong
Copy link
Contributor Author

getong commented Nov 14, 2023

我发现kotlin-language-server和sourcekit-lsp都有相同的问题,都有inlayhint能力,但没有告知客户端。我现在都是强制请求inlayhint消息。

@manateelazycat
Copy link
Owner

@getong 我提交了补丁 3cf9f9e

这样写既满足你的要求, 又不会影响其他正常响应 inlayHint 消息的 lsp server.

@getong
Copy link
Contributor Author

getong commented Nov 14, 2023

可以了,非常感谢。

@getong getong closed this Nov 14, 2023
@getong getong deleted the use-lsp-bridge-enable-inlay-hint-flag branch November 14, 2023 14:59
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

Successfully merging this pull request may close these issues.

2 participants