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

[LFX PreTest] pretest for LFX LSP hover content #1304

Closed
He1pa opened this issue May 10, 2024 · 6 comments · Fixed by #1331
Closed

[LFX PreTest] pretest for LFX LSP hover content #1304

He1pa opened this issue May 10, 2024 · 6 comments · Fixed by #1331
Labels
good first issue Good for newcomers help wanted Extra attention is needed lsp

Comments

@He1pa
Copy link
Contributor

He1pa commented May 10, 2024

pretest for #1244

Provide keyword syntax highlight in lsp hover
now:
image

expect:
image

pretest only needs to implement keyword highlighting, such as schema, Attribute, str, int

@Vishalk91-4
Copy link

@He1pa, can I work on this issue

@Peefy Peefy assigned Vishalk91-4 and unassigned Vishalk91-4 May 11, 2024
@Vishalk91-4
Copy link

@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

@Peefy
Copy link
Contributor

Peefy commented May 13, 2024

cc @He1pa

@d4v1d03
Copy link
Contributor

d4v1d03 commented May 13, 2024

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.

@He1pa
Copy link
Contributor Author

He1pa commented May 15, 2024

@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

@He1pa
Copy link
Contributor Author

He1pa commented May 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed lsp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants