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

Highlight At Commands #19

Open
valaises opened this issue May 9, 2024 · 0 comments
Open

Highlight At Commands #19

valaises opened this issue May 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@valaises
Copy link
Member

valaises commented May 9, 2024

Please, checkout the branch from this PR smallcloudai/refact-lsp#170. And run refact-lsp

cargo build && target/debug/refact-lsp --address-url https://dogfood.pilot.smallcloud.ai -k your_key --http-port 8001 --lsp-port 8002 --logs-stderr -b --ast --vecdb

connect your IDE to running refact-lsp to feed in some files.

Response from http://localhost:8001/v1/at-command-preview now contains a new field: highlight
That has a structure:

{
  kind: string  // could be "cmd" or "arg"
  ok: boolean  // true if cmd or arg is parsed correctly and can be executed
  pos1: int  // position in query, start
  pos2: int // position in query, end
  reason: String // empty if ok, otherwise gives you a reason why it isn't valid
}

For example for query:

...
my_text to execute @workspace and @definition BigFish
...

it shall give you a preview response like:

{
  "highlight":[
    {"kind":"cmd","ok":true,"pos1":24,"pos2":34,"reason":""},
    {"kind":"cmd","ok":true,"pos1":39,"pos2":50,"reason":""},
    {"kind":"arg","ok":true,"pos1":51,"pos2":58,"reason":""}
  ],
  "messages":[...],
  "model":"..."
}

Please, note:

  • if command (cmd + args) is not valid, not necessarily that both cmd + args will have ok: false. In some cases when cmd itself isn't valid, args are assumed to be valid.

What I think should be done:

  • objects given to you in highlight should be highlighted in a textbox. cmd and args should have different colors. Invalid cmds and args have to be underlined with some red color. On mouse hover, there should be a popup with reason, if cmd or args are ok, no popup on hover should be present.

The highlight should be ONLY in a textbox, not it messages in a chat (FYI, valid commands are clipped from text; invalid commands are not)

@valaises valaises added the enhancement New feature or request label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant