Skip to content

Run Neural to ask a specific question about part of a code sample #49

Open
@edi9999

Description

@edi9999

Right now, I was using Neural (successfully) to do some changes in my code :

def my_health(host)
  url = URI.parse("#{host}/health")

  req = Net::HTTP::Post.new(url.path)
  req.body_stream = StringIO.new(query)
  req.content_length = query.bytesize
  req.set_content_type("multipart/form-data", { "boundary" => BOUNDARY })

  Net::HTTP.start(url.host, url.port) {|http|
    begin
      response = http.request(req)
      if response.code != '200'
        raise "Error from server #{response.code}"
      end
      return response.body
    rescue => e
      raise e
    end
  }
end

This code was pasted from somewhere else in my application, and is for a POST request.

I just wanted to ask Chatgpt to change the code in order to do a GET Request.

What I did :

Select the content of the function using vim

Copy it to the main register

Run ":Neural Rewrite the following code to do a GET request : <hit Ctrl-R+" to paste the code>"

**What I would have liked: (to avoid copy-pasting) **

What I would have liked would be to ask a question to Neural and provide the context as a visual selection.

`:'<,'>Neural 'Please rewrite the code below to use a GET request on the /health route'

This would make life easier to be able to do that without any registers.

Metadata

Metadata

Assignees

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