Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Highlight At Commands #19

@v4ler11

Description

@v4ler11

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions