mattn / efm-langserver

General purpose Language Server
MIT License
1.34k stars 61 forks source link

Hover word charactor white list configuration #206

Closed Matts966 closed 2 years ago

Matts966 commented 2 years ago

Add hover-char option for splitting words for hover information.

To keep compatibility, we can use _ as the default setting.

mattn commented 2 years ago

Could you please explain your use case?

Matts966 commented 2 years ago

@mattn For example, I want to use . as hover-char to get keywords such as a.method and schema.table.

mattn commented 2 years ago

efm-langserver does not provide way to key assign for the text editor. You need to setup your text editor to call hover.

mattn commented 2 years ago

Ah, do you mean this condition?

https://github.com/mattn/efm-langserver/blob/b13f35f67c84029a83d245928ef29fa40b5e1d9c/langserver/handle_text_document_hover.go#L64

Matts966 commented 2 years ago

Yes! I mean that char variable!

mattn commented 2 years ago

I'm worried that this setting will cause hover to malfunction with ambiguous text. For example

Removed method foo.Bar.
Matts966 commented 2 years ago

@mattn You are right. This setting can cause unexpected results.

However, I think it is relatively easy to validate input texts in the hover-command and use trimmed texts or ignore invalid texts.

This new setting will make it possible to retrieve schema of target tables, and it is easy to ignore invalid or unknown tables in that case. Showing descriptions and schema for target tables can significantly improve query writing experience. Also, I believe this setting can make other useful cases possible.

mattn commented 2 years ago

Addressed in https://github.com/mattn/efm-langserver/pull/208

Matts966 commented 2 years ago

Thank you! It looks great!