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

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

Open
edi9999 opened this issue Jun 25, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@edi9999
Copy link

edi9999 commented Jun 25, 2024

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.

@w0rp w0rp self-assigned this Jul 8, 2024
@w0rp
Copy link
Member

w0rp commented Jul 8, 2024

@edi9999 Look at the documentation and look into the existing NeuralExplain command for a range. I recommend playing around with the code and creating pull requests tomake improvements to it.

@w0rp w0rp added the enhancement New feature or request label Jul 20, 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

2 participants