[LFX PreTest] pretest for LFX LSP hover content
pretest for https://github.com/kcl-lang/kcl/issues/1244
Provide keyword syntax highlight in lsp hover
now:
expect:
pretest only needs to implement keyword highlighting, such as schema, Attribute, str, int
@He1pa, can I work on this issue
@Peefy I worked on hover.rs chnaged few things in build_schema and inside the hover function
But, can you exactly tell what the change needs to look like and if you have a little idea on where I mean I get the current one, like I'm seeing the same thing on hovering in the above example for the expected one
cc @He1pa
Hey @Peefy , i was understanding the code for the same and have made a PR regarding a test case for the same, please have a look. #1311 . Though it doesn't solve this issue but i'll get it done by my next PR.
@Peefy I worked on hover.rs chnaged few things in build_schema and inside the hover function
But, can you exactly tell what the change needs to look like and if you have a little idea on where I mean I get the current one, like I'm seeing the same thing on hovering in the above example for the expected one
I don't understand what your problem is. Our current hover is a text rendered in markdown format, like the first picture. But we need to optimize it and add syntax highlighting to some keywords, like in the second picture (this is Rust's hover by rust-analyzer). You need to investigate how to render colors in lsp hover. You can refer to other common language lsp practices. For example: https://github.com/rust-lang/rust-analyzer/blob/c0732c9f0f91bdc31d8da320be16d1db06c848d8/crates/rust-analyzer/src/handlers/request.rs#L1059
Rust-analyzer solution does not seem to be suitable, it is highlighted through markdown code blocks, like
```rust some code ```
but ```kcl is not work in markdown. Maybe we can ref: https://github.com/tweag/nickel/blob/2c7dd14b5422ad4d7db6f3868db630d5482b2a75/lsp/nls/src/requests/hover.rs#L128