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

"Generate Code" not work. #64

Closed
stephsix opened this issue Sep 9, 2021 · 4 comments
Closed

"Generate Code" not work. #64

stephsix opened this issue Sep 9, 2021 · 4 comments

Comments

@stephsix
Copy link

stephsix commented Sep 9, 2021

extension version: v3.1.0
operating system: mac os
problem:
I clicked the "Generate Code" command in the right click popup menu, after choosing the target template(e.g. Shell - cURL), nothing happened except a quickly flashed process notify.

@AnWeber
Copy link
Owner

AnWeber commented Sep 9, 2021

Thank you for reporting. Do you get an error message. This would appear in the output in the httpyac - Log tab. Would be great. Otherwise I will try it out myself.

@stephsix
Copy link
Author

stephsix commented Sep 9, 2021

In my case, there is not any error message appear in the httpyacc - Log tab.
I forked your great job and tried it locally with my Macbook Air, finding that there may be something wrong with the method "generateCodeRequest" in (src/provider/harCommandsController.ts):
image
It never hit my breakpoint on the callback of context.httpClient during "Generate Code".
FYI, here is my testing code:

// gen_code_not_work.http
{{
    exports.date = "2021-09-10"
}}

GET https://httpbin.org/json HTTP/1.1
Date: {{date}}

@AnWeber
Copy link
Owner

AnWeber commented Sep 9, 2021

This is exactly the right method. Probably the error is in httpyac, which does not use the httpClient correctly.
If you want to continue looking there, here's what you'd have to do.

  1. git clone, npm install and npm link in httpyac folder
  2. npm link httpyac in vscode-httpyac folder
  3. modifypackage.json of httpyac (remove "types" and change "main" from dist to src)
{
  "main": "./src/index.ts",
  "types2": "./dist/index.d.ts",
  1. modify tsconfig.json in vscode-httpyac (add httpyac to rootDir)
{
  "compilerOptions": {
     "rootDirs": ["src", "./node_modules/httpyac/src"],
  }
}
  1. npm run watch in vscode-httpyac

After these changes, when vscode-httpyac debug session is started, the httpyac source can also be debugged.

You don't necessarily have to find the bug. I'll be happy to take a look at it though, I'd just check out the support for GRPC before I do that.

@AnWeber
Copy link
Owner

AnWeber commented Sep 12, 2021

The cause was that the httpClient was overwritten in the api. I took the opportunity and rewrote the logic to use logResponse interface. With version 3.2.0 the call should work correctly again

@AnWeber AnWeber closed this as completed Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants