ocamllabs / ocamllabs/vscode-ocaml-platform

"Evaluate selection" is not handling text correctly

Open
#1,663 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
OCaml
Stars
386
Forks
86
Avg merge
9h 42m
Merged PRs (30d)
14

Description

When I select text in a window and use the "Evaluate selection" command, not all text in the selection is sent to utop.

The observed behavior seems to be something like:

  1. Take up to the next 50 characters from the selected region into a buffer, stopping if you reach the end of the selected region
  2. If the buffer contains the end of the phrase, send the entire buffer to utop and stop. Otherwise go to step 1

This behavior doesn't make a lot of sense to me. Either it should send the entire selection to utop, or it should only send the first complete phrase from the selected region. In the following code, for example,

let aa = 1;;
let bb = 2;;
let cc = 3;;
let ddd = 4;;

it sends the first 50 characters and stops, so what utop actually receives is

let aa = 1;;
let bb = 2;;
let cc = 3;;
let ddd = 4

Or, if the first phrase is, say, 70 characters, and the next phrase is also 70 characters, then if I select both phrases, it will send 100 characters and stop.

I am using OCaml through WSL2 if this is relevant.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the implementation of the “Evaluate selection” command and reproduce the issue with multiple selected OCaml phrases, including phrases longer than 50 characters. Trace how the selection is chunked before it is sent to utop; confirm with maintainers whether completion means sending the entire selection or only the first complete phrase, then verify that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.