-
Notifications
You must be signed in to change notification settings - Fork 677
Develop new function to show the content of problem #127
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
Conversation
...em" is changed to "show to solve problem"
... Webview to show the description in HTML format
@qyazhang Thank you for contribution, would you mind to fix the CI failure first?
Thanks, I will fix it later (I'm sorry that I'm not so familiar with Typescript and this testing tool)
Actually, I prefer creating an issue before sending out the PR.
In the issue, we can discuss the implementation first. Also this could be a chance to get feedback from the community.
I'm sorry I may need further time to solve the problem of "vsce package", I will close it and issue/PR again. Sorry for troubling
@qyazhang Don't worry, it's fine.
What kind of problem are you meeting with. I'm willing to help if I can.
Thanks for your kind.
I searched the error message and few solutions are found. I will try to debug it these days to find which changes lead to this error (the error message didn't indicate which parts lead to this error), if faced the same error again, I will try to solve it with you.
@qyazhang What error message were you get?
It show the error message like this
Executing prepublish script 'npm run vscode:prepublish'...
ERROR Command failed: npm run vscode:prepublish
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! vscode-leetcode@0.10.2 compile:tsc -p ./
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the vscode-leetcode@0.10.2 compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhang/.npm/_logs/2019-02-25T03_23_53_058Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! vscode-leetcode@0.10.2 vscode:prepublish:npm run compile
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the vscode-leetcode@0.10.2 vscode:prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhang/.npm/_logs/2019-02-25T03_23_53_083Z-debug.log
And the details in log is shown like this
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'compile' ]
2 info using npm@6.8.0
3 info using node@v10.13.0
4 verbose run-script [ 'precompile', 'compile', 'postcompile' ]
5 info lifecycle vscode-leetcode@0.10.2(削除) precompile: vscode-leetcode@0.10.2compile: vscode-leetcode@0.10.2
6 info lifecycle vscode-leetcode@0.10.2 (削除ここまで)
7 verbose lifecycle vscode-leetcode@0.10.2(削除) compile: unsafe-perm in lifecycle truecompile: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/zhang/git/vscode-leetcode/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/zhang/git/vscode-leetcode/node_modules/.bin:/Users/zhang/perl5/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/git/bin:/usr/local/sbin:/usr/local/git/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/zhang/.rvm/bin:/Users/zhang/.rvm/bin
8 verbose lifecycle vscode-leetcode@0.10.2 (削除ここまで)
9 verbose lifecycle vscode-leetcode@0.10.2(削除) compile: CWD: /Users/zhang/git/vscode-leetcodecompile: Args: [ '-c', 'tsc -p ./' ]
10 silly lifecycle vscode-leetcode@0.10.2 (削除ここまで)
11 silly lifecycle vscode-leetcode@0.10.2(削除) compile: Returned: code: 2 signal: nullcompile: Failed to exec compile script
12 info lifecycle vscode-leetcode@0.10.2 (削除ここまで)
13 verbose stack Error: vscode-leetcode@0.10.2 compile:tsc -p ./
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid vscode-leetcode@0.10.2
15 verbose cwd /Users/zhang/git/vscode-leetcode
16 verbose Darwin 17.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "compile"
18 verbose node v10.13.0
19 verbose npm v6.8.0
20 error code ELIFECYCLE
21 error errno 2
22 error vscode-leetcode@0.10.2 compile:tsc -p ./
22 error Exit status 2
23 error Failed at the vscode-leetcode@0.10.2 compile script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
(I'm sorry I'm busy at other things and didn't get further developement)
This PR is started from the consideration that when I use this extension to solve leetcode problem, I always want to first check the description of the problem and then consider whether I will start to solve it or not. But right now "show problem" function only assume I want to solve it and create a source code file, and I could only see the problem description in that.
So I start to create a new "show problem" function to replace the original one, which could get the context of problem description and show it in a new window instead of creating a source code file.
What have done:
create new "showProblem" function
rename original "showProblem" function to "showToSolveProblem"
send post request to leetcode's graphql and open a WebView to show the description content referring to leetcode-cli
add "show problem" to right-click menu, and rename original "show problem" to "solve problem"
What haven't done:
Haven't add the "showProblem" support for "leetcode-cn.com"
Haven't add the left-click event to problem items to directly open the description content when we left-click (I've tried to implement it, and inherit LeetCodeNode from TreeItem and give command to each LeetCodeNode, but it didn't work. It may need further discussion)