[
  {
    "path": ".github/ISSUE_TEMPLATE/bug.md",
    "content": "---\nname: 🐛 Bug report\nabout: Create a report to help us improve\n---\n\n## 🐛 Bug Report\n\nA clear and concise description of what the bug is.\n\n## To Reproduce\n\nSteps to reproduce the behavior.\n\n## Expected behavior\n\nA clear and concise description of what you expected to happen.\n\n## Extension Output\n\nPaste here the LeetCode extension log from output channel.\n\nGuidance: Press `Ctrl+Shift+U`, and toggle the channel to `LeetCode`.\n\n## Your Environment\n\n- *os*:\n- *extension settings*:\n- *nodejs version*:\n- *vscode version*:\n- *extension version*:\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature.md",
    "content": "---\nname: 🚀 Feature Proposal\nabout: Submit a proposal for a new feature\n---\n\n## 🚀 Feature Proposal\n\nA clear and concise description of what the feature is.\n\n## Motivation\n\nPlease outline the motivation for the proposal.\n\n## Contribution\n\nPlease describe the solution if you'd like to submit a PR.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/question.md",
    "content": "---\nname: 💬 Questions / Help\nabout: If you have questions, please check our documents first\n---\n\nBefore you submit an question we recommend you to check out the [DOCUMENT](https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/README.md) first.\n\nYou can also find more information in:\n- [TROUBLESHOOTING](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/Troubleshooting)\n- [FAQ](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/FAQ)\n\n## 💬 Questions and Help\n\nPlease outline the questions.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "*It's really recommended to create an issue by a template.*\n"
  },
  {
    "path": ".github/no-response.yml",
    "content": "daysUntilClose: 14\nresponseRequiredLabel: need more info\ncloseComment: >\n  This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: CI\n\non:\n  push:\n    branches: [master]\n  pull_request:\n    branches: [master]\n\njobs:\n  linux:\n    name: Linux\n    runs-on: ubuntu-latest\n    timeout-minutes: 30\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Setup Node.js environment\n        uses: actions/setup-node@v2\n        with:\n          node-version: 14\n\n      - name: Install Node.js modules\n        run: npm install\n\n      - name: Lint\n        run: npm run lint\n\n      - name: VSCE Packge\n        run: npx vsce package\n\n  windows:\n    name: Windows\n    runs-on: windows-latest\n    timeout-minutes: 30\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Setup Node.js environment\n        uses: actions/setup-node@v2\n        with:\n          node-version: 14\n\n      - name: Install Node.js modules\n        run: npm install\n\n      - name: Lint\n        run: npm run lint\n\n      - name: VSCE Packge\n        run: npx vsce package\n"
  },
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (http://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# Typescript v1 declaration files\ntypings/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n\n# Output\nout\n*.vsix\n.vscode-test\n\n# Mac\n.DS_Store\n"
  },
  {
    "path": ".vscode/launch.json",
    "content": "// A launch configuration that compiles the extension and then opens it inside a new window\n{\n    \"version\": \"0.1.0\",\n    \"configurations\": [\n        {\n            \"name\": \"Launch Extension\",\n            \"type\": \"extensionHost\",\n            \"request\": \"launch\",\n            \"runtimeExecutable\": \"${execPath}\",\n            \"args\": [\"--extensionDevelopmentPath=${workspaceRoot}\" ],\n            \"stopOnEntry\": false,\n            \"sourceMaps\": true,\n            \"outFiles\": [ \"${workspaceRoot}/out/src/**/*.js\" ],\n            \"preLaunchTask\": \"npm\"\n        },\n        {\n            \"name\": \"Launch Tests\",\n            \"type\": \"extensionHost\",\n            \"request\": \"launch\",\n            \"runtimeExecutable\": \"${execPath}\",\n            \"args\": [\"--extensionDevelopmentPath=${workspaceRoot}\", \"--extensionTestsPath=${workspaceRoot}/out/test\" ],\n            \"stopOnEntry\": false,\n            \"sourceMaps\": true,\n            \"outFiles\": [ \"${workspaceRoot}/out/test/**/*.js\" ],\n            \"preLaunchTask\": \"npm\"\n        }\n    ]\n}"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n    \"editor.formatOnSave\": false,\n    \"editor.insertSpaces\": true,\n    \"editor.tabSize\": 4,\n    \"files.insertFinalNewline\": true,\n    \"files.trimTrailingWhitespace\": true,\n    \"search.exclude\": {\n        \"out\": true,\n        \"**/node_modules\": true,\n        \".vscode-test\": true\n    },\n    \"tslint.autoFixOnSave\": true,\n    \"tslint.ignoreDefinitionFiles\": true,\n    \"prettier.tabWidth\": 4,\n    \"prettier.useTabs\": false,\n    \"prettier.printWidth\": 150\n}\n"
  },
  {
    "path": ".vscode/tasks.json",
    "content": "{\n    \"version\": \"2.0.0\",\n    \"tasks\": [\n        {\n            \"label\": \"npm\",\n            \"type\": \"shell\",\n            \"command\": \"npm\",\n            \"group\": {\n                \"kind\": \"build\",\n                \"isDefault\": true\n            },\n            \"args\": [\n                \"run\",\n                \"compile\",\n                \"--loglevel\",\n                \"silent\"\n            ],\n            \"isBackground\": true,\n            \"presentation\": {\n                \"reveal\": \"silent\"\n            },\n            \"problemMatcher\": \"$tsc-watch\"\n        },\n        {\n            \"type\": \"npm\",\n            \"script\": \"lint\",\n            \"problemMatcher\": {\n                \"base\": \"$tslint5\",\n                \"fileLocation\": \"absolute\"\n            }\n        }\n    ]\n}"
  },
  {
    "path": ".vscodeignore",
    "content": ".vscode/**\n.vscode-test/**\nout/test/**\ntest/**\nsrc/**\n**/*.map\n.gitignore\npackage-lock.json\ntsconfig.json\ntslint.json\n**/*.gif\nACKNOWLEDGEMENTS.md\ndocs\n.github\n"
  },
  {
    "path": "ACKNOWLEDGEMENTS.md",
    "content": "## Contributors 🙏❤\n\nA big thanks to the following individuals for contributing:\n\n- [@JIEJIAN21](https://github.com/JIEJIAN21) - thanks for logo and icon design\n- [@TsFreddie](https://github.com/TsFreddie) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=TsFreddie)\n- [@ntt2k](https://github.com/ntt2k) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=ntt2k)\n- [@purocean](https://github.com/purocean) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=purocean)\n- [@Xeonacid](https://github.com/Xeonacid) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=Xeonacid)\n- [@Himself65](https://github.com/Himself65) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=Himself65)\n- [@Vigilans](https://github.com/Vigilans) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=Vigilans)\n- [@ringcrl](https://github.com/ringcrl) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=ringcrl)\n- [@pujiaxun](https://github.com/pujiaxun) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=pujiaxun)\n- [@edvardchen](https://github.com/edvardchen) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=edvardchen)\n- [@poppinlp](https://github.com/poppinlp) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=poppinlp)\n- [@xuzaixian](https://github.com/xuzaixian) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=xuzaixian)\n- [@ZainChen](https://github.com/ZainChen) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=ZainChen)\n- [@houtianze](https://github.com/houtianze) — [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=houtianze)\n- [@magic-akari](https://github.com/magic-akari) - [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=magic-akari)\n- [@SF-Zhou](https://github.com/SF-Zhou) - [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=SF-Zhou)\n- [@fuafa](https://github.com/fuafa) - [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=fuafa)\n- [@iFun](https://github.com/iFun) - [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=iFun)\n- [@hologerry](https://github.com/hologerry) - [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=hologerry)\n- [@yihong0618](https://github.com/yihong0618) - [contributions](https://github.com/LeetCode-OpenSource/vscode-leetcode/commits?author=yihong0618)\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Change Log\nAll notable changes to the \"leetcode\" extension will be documented in this file.\n\nCheck [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.\n\n## [0.18.4]\n### Added\n- change graphql path\n\n## [0.18.3]\n### Added\n- re-add cookie-based login method  [PR#969](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/969)\n\n## [0.18.2]\n### Fixed\n- fix login issue on VS Code Insiders  [PR#968](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/968)\n\n## [0.18.1]\n### Changed\n- change login way and add tracking logic option [PR#944](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/944)\n\n## [0.18.0]\n### Added\n- Add `star` command in shortcuts [PR#601](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/601)\n- Add an option to disable endpoint translation [#389](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/389)\n\n### Changed\n- LeetCode actions are moved into sub-menu: `LeetCode` in the editor context menu. [PR#712](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/712)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.18.0+is%3Aclosed+label%3Abug)\n\n## [0.17.0]\n### Added\n- Add TypeScript support [#560](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/560)\n\n### Changed\n- Update the UI resources [PR#561](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/561)\n\n## [0.16.2]\n### Added\n- New Category: `Concurrency` [CLI#42](https://github.com/leetcode-tools/leetcode-cli/pull/42)\n- New configuration to better configure how to show the description [#310](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/310)\n\n### Removed\n- Removed the deprecated setting `leetcode.enableShortcuts` [PR#520](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/520)\n- Removed the deprecated setting `leetcode.outputFolder` [PR#521](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/521)\n\n## [0.16.1]\n### Added\n- Can show the problem in current workspace even if it's not a LeetCode workspace [#373](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/373)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.16.1+is%3Aclosed+label%3Abug)\n\n## [0.16.0]\n### Added\n- Support GitHub login and LinkedIn login [PR#496](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/496)\n\n## [0.15.8]\n### Added\n- Add a new command `Sign In by Cookie` to workaround the issue that [users cannot login to LeetCode](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478). Please check the [workaround steps](https://github.com/LeetCode-OpenSource/vscode-leetcode/tree/master#%EF%B8%8F-attention-%EF%B8%8F--workaround-to-login-to-leetcode-endpoint) for more details!\n\n### Changed\n- Update the explorer icons to be align with the VS Code design [#460](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/460)\n\n## [0.15.7]\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.7+is%3Aclosed+label%3Abug)\n\n## [0.15.6]\n### Added\n- Add a link to the solution page [#424](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/424)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.6+is%3Aclosed+label%3Abug)\n\n## [0.15.5]\n### Added\n- Add a link to the discussion page [#420](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/420)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.5+is%3Aclosed+label%3Abug)\n\n## [0.15.4]\n### Added\n- Add a new setting `leetcode.filePath`. Now users can use this setting to dynamicly specify the relative folder name and file name. [#PR380](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/380)\n\n### Fixed\n- Missing language `Rust` in the supported language list. [#PR412](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/412)\n- Cannot show output when the answer is wrong. [#414](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/414)\n\n## [0.15.3]\n### Added\n- Support `Pick One` [#263](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/263)\n- Support toggling the favorite problems [#378](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/378)\n\n### Changed\n- Update the activity bar icon [#395](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/263)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.3+is%3Aclosed+label%3Abug)\n\n## [0.15.2]\n### Added\n- Prompt to open the workspace for LeetCode [#130](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/130)\n- Support deleting sessions [#198](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/130)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.2+is%3Aclosed+label%3Abug)\n\n## [0.15.1]\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.1+is%3Aclosed+label%3Abug)\n\n## [0.15.0]\n### Added\n- Auto refresh the explorer after submitting [#91](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/91)\n- Add a editor shortcut `Description` to show the problem description [#286](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/286)\n- Support customizing the shortcuts in editor [#335](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/335)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.0+is%3Aclosed+label%3Abug)\n\n## [0.14.3]\n### Added\n- Support interpolation for `leetcode.outputFolder` settings [#151](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/151)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.14.3+label%3Abug)\n\n## [0.14.2]\n### Added\n- Add the `All` category in the LeetCode Explorer [#184](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/184)\n- Add shortcuts for `Show top voted solution` [#269](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/269)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+is%3Aclosed+label%3Abug+milestone%3A0.14.2)\n\n## [0.14.1]\n### Added\n- Add setting `leetcode.showCommentDescription` to specify whether including the problem description in comments or not [#287](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/287)\n\n## [0.14.0]\n### Added\n- Add setting `leetcode.enableShortcuts` to specify whether to show the submit/test shortcuts in editor [#146](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/146)\n- Add `Like` and `Dislike` counts in the problem description [#267](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/267)\n\n### Changed\n- Improve the `Preview`, `Result` and `Solution` views\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+label%3Abug+is%3Aclosed+milestone%3A0.14.0)\n\n## [0.13.3]\n### Fixed\n- Fix the bug that the extension cannot be activated\n\n## [0.13.2]\n### Added\n- Add a setting `leetcode.enableStatusBar` to specify whether the LeetCode status bar will be shown or not [#156](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/156)\n- Add a setting `leetcode.nodePath` to specify the `Node.js` executable path [#227](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/227)\n\n### Changed\n- Update the activity bar icon, See: [#225](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/225)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.13.2+is%3Aclosed+label%3Abug)\n\n## [0.13.1]\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.13.1+is%3Aclosed+label%3Abug)\n\n## [0.13.0]\n### Added\n- Preview the problem description [#131](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/131)\n- Show top voted solution [#193](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/193)\n- Add `collapse all` for the explorer [#197](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/197)\n\n### Fixed\n[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.13.0+label%3Abug)\n\n## [0.12.0]\n### Added\n- Add new command `LeetCode: Switch Default Language` to support switching the default language [#115](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/115)\n- Support `PHP` and `Rust` ([#83](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/83), [#103](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/103))\n\n### Fixed\n- Cannot retrieve time and memory result [#105](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/105)\n- Power operator displays in a wrong way [#74](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/74)\n\n## [0.11.0]\n### Added\n- Add new setting: `leetcode.outputFolder` to customize the sub-directory to save the files generated by 'Show Problem' [#119](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/119)\n- Add tooltips for sub-category nodes in LeetCode Explorer [#143](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/143)\n\n### Changed\n- Now when triggering 'Show Problem', the extension will not generate a new file if it already exists [#59](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/59)\n\n### Fixed\n- Log in timeout when proxy is enabled [#117](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/117)\n\n## [0.10.2]\n### Fixed\n- Test cases cannot have double quotes [#60](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/60)\n\n## [0.10.1]\n### Changed\n- Refine the README page.\n\n## [0.10.0]\n### Added\n- Add an extension setting to hide solved problems [#95](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/95)\n- Support categorize problems by company, tag, difficulty and favorite [#67](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/67)\n\n## [0.9.0]\n### Changed\n- Improve the experience of switching endpoint [#85](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/85)\n- Use web view to show the result page [#76](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/76)\n\n\n## [0.8.2]\n### Added\n- Add Code Lens for submitting the answer to LeetCode\n\n### Fixed\n- Fix the bug that the extension could not automatically sign in [#72](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/72)\n\n## [0.8.1]\n### Changed\n- Upgrade LeetCode CLI to v2.6.1\n\n## [0.8.0]\n### Added\n- Support LeetCode CN [#50](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/50)\n- Support Windows Subsystem for Linux [#47](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/47)\n\n## [0.7.0]\n### Added\n- Add spinner when submitting code [#43](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/43)\n\n## [0.6.1]\n### Added\n- Add Sign in action into LeetCode Explorer title area [#25](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/25)\n\n## [0.6.0]\n### Changed\n- Move LeetCode explorer into activity bar [#39](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/39)\n\n### Added\n- Support trigger test & submit in the editor [#37](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/37)\n\n### Fixed\n- Fix the bug that cannot show problem [#41](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/41)\n\n## [0.5.1]\n### Fixed\n- Fix the bug when user's path contains white spaces [#34](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/34)\n\n## [0.5.0]\n### Added\n- Support submit and test solution files from the file explorer in VS Code ([#24](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/24), [#26](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/26))\n\n## [0.4.0]\n### Added\n- Support locked problem [#20](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/20)\n\n### Changed\n- Simplify the command 'LeetCode: Test Current File' to 'LeetCode: Test' [#18](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/18)\n- Will automatically save current file when 'LeetCode: Test' command is triggered [#17](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/17)\n\n## [0.3.0]\n### Added\n- Test current solution file [#15](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/15)\n\n## [0.2.1]\n### Fixed\n- Fix the wrong icon bug in LeetCode Explorer [#9](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/9)\n- Fix the switch session bug when login session is expired [#12](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/12)\n\n## [0.2.0]\n### Added\n- Support setting the default language to solve problems [#5](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/5)\n\n### Fixed\n- When user cancels login, no further actions will happen [#10](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/10)\n\n## [0.1.2]\n### Fixed\n- Fix the duplicated nodes in LeetCode Explorer bug [#6](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/6)\n\n## [0.1.1]\n### Fixed\n- Fix a bug in LeetCode Explorer [#3](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/3)\n- Remove the show problem command from command palette [#4](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/4)\n\n## [0.1.0]\n### Added\n- Sign in/out to LeetCode\n- Switch and create session\n- Show problems in explorer\n- Search problems by keywords\n- Submit solutions to LeetCode\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2020-present 力扣\nCopyright (c) 2018-2019 jdneo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# LeetCode\n\n> Solve LeetCode problems in VS Code\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/resources/LeetCode.png\" alt=\"\">\n</p>\n<p align=\"center\">\n  <a href=\"https://github.com/LeetCode-OpenSource/vscode-leetcode/actions?query=workflow%3ACI+branch%3Amaster\">\n    <img src=\"https://img.shields.io/github/workflow/status/LeetCode-OpenSource/vscode-leetcode/CI/master?style=flat-square\" alt=\"\">\n  </a>\n  <a href=\"https://gitter.im/vscode-leetcode/Lobby\">\n    <img src=\"https://img.shields.io/gitter/room/LeetCode-OpenSource/vscode-leetcode.svg?style=flat-square\" alt=\"\">\n  </a>\n  <a href=\"https://marketplace.visualstudio.com/items?itemName=LeetCode.vscode-leetcode\">\n    <img src=\"https://img.shields.io/visual-studio-marketplace/d/LeetCode.vscode-leetcode.svg?style=flat-square\" alt=\"\">\n  </a>\n  <a href=\"https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/LICENSE\">\n    <img src=\"https://img.shields.io/github/license/LeetCode-OpenSource/vscode-leetcode.svg?style=flat-square\" alt=\"\">\n  </a>\n</p>\n\n- English Document | [中文文档](https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/docs/README_zh-CN.md)\n\n## ❗️ Attention ❗️- Workaround to login to LeetCode endpoint\n\n> Note: If you are using `leetcode.cn`, you can just ignore this section.\n\nRecently we observed that [the extension cannot login to leetcode.com endpoint anymore](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478). The root cause of this issue is that leetcode.com changed its login mechanism and so far there is no ideal way to fix that issue.\n\nThanks for [@yihong0618](https://github.com/yihong0618) provided a workaround which can somehow mitigate this. Now you can simply click the `Sign In` button and then select `Third Party` login or `Cookie` login.\n\n> Note: If you want to use third-party login(**Recommended**), please make sure your account has been connected to the third-party. If you want to use `Cookie` login, click [here](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478#issuecomment-564757098) to see the steps.\n\n## Requirements\n\n- [VS Code 1.30.1+](https://code.visualstudio.com/)\n- [Node.js 10+](https://nodejs.org)\n  > NOTE: Please make sure that `Node` is in your `PATH` environment variable. You can also use the setting `leetcode.nodePath` to specify the location of your `Node.js` executable.\n\n## Quick Start\n\n![demo](https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/gifs/demo.gif)\n\n## Features\n\n### Sign In/Out\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/sign_in.png\" alt=\"Sign in\" />\n</p>\n\n- Simply click `Sign in to LeetCode` in the `LeetCode Explorer` will let you **sign in** with your LeetCode account.\n\n- You can also use the following command to sign in/out:\n  - **LeetCode: Sign in**\n  - **LeetCode: Sign out**\n\n---\n\n### Switch Endpoint\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/endpoint.png\" alt=\"Switch Endpoint\" />\n</p>\n\n- By clicking the button ![btn_endpoint](https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/btn_endpoint.png) at the **explorer's navigation bar**, you can switch between different endpoints.\n\n- The supported endpoints are:\n\n  - **leetcode.com**\n  - **leetcode.cn**\n\n  > Note: The accounts of different endpoints are **not** shared. Please make sure you are using the right endpoint. The extension will use `leetcode.com` by default.\n\n---\n\n### Pick a Problem\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/pick_problem.png\" alt=\"Pick a Problem\" />\n</p>\n\n- Directly click on the problem or right click the problem in the `LeetCode Explorer` and select `Preview Problem` to see the problem description.\n- Select `Show Problem` to directly open the file with the problem description.\n\n  > Note：You can specify the path of the workspace folder to store the problem files by updating the setting `leetcode.workspaceFolder`. The default value is：**$HOME/.leetcode/**.\n\n  > You can specify whether including the problem description in comments or not by updating the setting `leetcode.showCommentDescription`.\n\n  > You can switch the default language by triggering the command: `LeetCode: Switch Default Language`.\n\n---\n\n### Editor Shortcuts\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/shortcuts.png\" alt=\"Editor Shortcuts\" />\n</p>\n\n- The extension supports 5 editor shortcuts (aka Code Lens):\n\n  - `Submit`: Submit your answer to LeetCode.\n  - `Test`: Test your answer with customized test cases.\n  - `Star/Unstar`: Star or unstar the current problem.\n  - `Solution`: Show the top voted solution for the current problem.\n  - `Description`: Show the problem description page.\n\n  > Note: You can customize the shortcuts using the setting: `leetcode.editor.shortcuts`. By default, only `Submit` and `Test` shortcuts are enabled.\n\n---\n\n### Search problems by Keywords\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/search.png\" alt=\"Search problems by Keywords\" />\n</p>\n\n- By clicking the button ![btn_search](https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/btn_search.png) at the **explorer's navigation bar**, you can search the problems by keywords.\n\n---\n\n### Manage Session\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/session.png\" alt=\"Manage Session\" />\n</p>\n\n- To manage your LeetCode sessions, just clicking the `LeetCode: ***` at the bottom of the status bar. You can **switch** between sessions or **create**, **delete** a session.\n\n## Settings\n\n| Setting Name                      | Description                                                                                                                                                                                                                                                   | Default Value      |\n| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |\n| `leetcode.hideSolved`             | Specify to hide the solved problems or not                                                                                                                                                                                                                    | `false`            |\n| `leetcode.defaultLanguage`        | Specify the default language used to solve the problem. Supported languages are: `bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `php`, `python`,`python3`,`ruby`,`rust`, `scala`, `swift`, `typescript`                     | `N/A`              |\n| `leetcode.useWsl`                 | Specify whether to use WSL or not                                                                                                                                                                                                                             | `false`            |\n| `leetcode.endpoint`               | Specify the active endpoint. Supported endpoints are: `leetcode`, `leetcode-cn`                                                                                                                                                                               | `leetcode`         |\n| `leetcode.workspaceFolder`        | Specify the path of the workspace folder to store the problem files.                                                                                                                                                                                          | `\"\"`               |\n| `leetcode.filePath`               | Specify the relative path under the workspace and the file name to save the problem files. More details can be found [here](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/Customize-the-Relative-Folder-and-the-File-Name-of-the-Problem-File). |                    |\n| `leetcode.enableStatusBar`        | Specify whether the LeetCode status bar will be shown or not.                                                                                                                                                                                                 | `true`             |\n| `leetcode.editor.shortcuts`       | Specify the customized shortcuts in editors. Supported values are: `submit`, `test`, `star`, `solution` and `description`.                                                                                                                                    | `[\"submit, test\"]` |\n| `leetcode.enableSideMode`         | Specify whether `preview`, `solution` and `submission` tab should be grouped into the second editor column when solving a problem.                                                                                                                            | `true`             |\n| `leetcode.nodePath`               | Specify the `Node.js` executable path. for example, C:\\Program Files\\nodejs\\node.exe                                                                                                                                                                          | `node`             |\n| `leetcode.showCommentDescription` | Specify whether to include the problem description in the comments                                                                                                                                                                                            | `false`            |\n| `leetcode.useEndpointTranslation` | Use endpoint's translation (if available)                                                                                                                                                                                                                     | `true`             |\n| `leetcode.colorizeProblems`       | Add difficulty badge and colorize problems files in explorer tree                                                                                                                                                                                             | `true`             |\n| `leetcode.problems.sortStrategy`  | Specify sorting strategy for problems list                                                                                                                                                                                                                    | `None`             |\n| `leetcode.allowReportData`        | Allow LeetCode to report anonymous usage data to improve the product. list                                                                                                                                                                                    | `true`             |\n\n## Want Help?\n\nWhen you meet any problem, you can check out the [Troubleshooting](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/Troubleshooting) and [FAQ](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/FAQ) first.\n\nIf your problem still cannot be addressed, feel free to reach us in the [Gitter Channel](https://gitter.im/vscode-leetcode/Lobby) or [file an issue](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/new/choose).\n\n## Release Notes\n\nRefer to [CHANGELOG](https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/CHANGELOG.md)\n\n## Acknowledgement\n\n- This extension is based on [@skygragon](https://github.com/skygragon)'s [leetcode-cli](https://github.com/skygragon/leetcode-cli) open source project.\n- Special thanks to our [contributors](https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/ACKNOWLEDGEMENTS.md).\n"
  },
  {
    "path": "_config.yml",
    "content": "theme: jekyll-theme-cayman"
  },
  {
    "path": "docs/README_zh-CN.md",
    "content": "# LeetCode\n\n> 在 VS Code 中练习 LeetCode\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/resources/LeetCode.png\" alt=\"\">\n</p>\n<p align=\"center\">\n  <a href=\"https://github.com/LeetCode-OpenSource/vscode-leetcode/actions?query=workflow%3ACI+branch%3Amaster\">\n    <img src=\"https://img.shields.io/github/workflow/status/LeetCode-OpenSource/vscode-leetcode/CI/master?style=flat-square\" alt=\"\">\n  </a>\n  <a href=\"https://gitter.im/vscode-leetcode/Lobby\">\n    <img src=\"https://img.shields.io/gitter/room/LeetCode-OpenSource/vscode-leetcode.svg?style=flat-square\" alt=\"\">\n  </a>\n  <a href=\"https://marketplace.visualstudio.com/items?itemName=LeetCode.vscode-leetcode\">\n    <img src=\"https://img.shields.io/visual-studio-marketplace/d/LeetCode.vscode-leetcode.svg?style=flat-square\" alt=\"\">\n  </a>\n  <a href=\"https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/LICENSE\">\n    <img src=\"https://img.shields.io/github/license/LeetCode-OpenSource/vscode-leetcode.svg?style=flat-square\" alt=\"\">\n  </a>\n</p>\n\n- [English Document](https://github.com/LeetCode-OpenSource/vscode-leetcode#requirements) | 中文文档\n\n## ❗️ 注意 ❗️- 无法登录 LeetCode 节点的临时解决办法\n\n> 注意：如果使用的是 `leetcode.cn` 账户，可以跳过此段落。\n\n近期我们发现插件出现了[无法登录 leetcode.com 节点的问题](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478)。原因是因为近期 leetcode.com 改变了登录机制，目前我们暂时没有找到解决该问题的完美解决方案。\n\n感谢 [@yihong0618](https://github.com/yihong0618) 提供了一个临时解决办法。现在你可以直接点击登录按钮并选择第三方登录或者 `Cookie` 登录。\n\n> 注意：如果你希望使用第三方登录（**推荐**），请确保你的账户已经与第三方账户连接。如果你希望通过 `Cookie` 登录，请点击[该连接](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478#issuecomment-564757098)查看登录步骤。\n\n## 运行条件\n\n- [VS Code 1.23.0+](https://code.visualstudio.com/)\n- [Node.js 10+](https://nodejs.org)\n  > 注意：请确保`Node`在`PATH`环境变量中。您也可以通过设定 `leetcode.nodePath` 选项来指定 `Node.js` 可执行文件的路径。\n\n## 快速开始\n\n![demo](https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/gifs/demo.gif)\n\n## 功能\n\n### 登入登出\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/sign_in.png\" alt=\"登入登出\" />\n</p>\n\n- 点击 `LeetCode Explorer` 中的 `Sign in to LeetCode` 即可登入。\n\n- 你也可以使用下来命令登入或利用 cookie 登入或登出:\n  - **LeetCode: Sign in**\n  - **LeetCode: Sign out**\n\n---\n\n### 切换 LeetCode 版本\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/endpoint.png\" alt=\"切换 LeetCode 版本\" />\n</p>\n\n- LeetCode 目前有**英文版**和**中文版**两种版本。点击 `LeetCode Explorer` 导航栏中的 ![btn_endpoint](https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/btn_endpoint.png) 按钮可切换版本。\n\n- 目前可切换的版本有:\n\n  - **leetcode.com**\n  - **leetcode.cn**\n\n  > 注意：两种版本的 LeetCode 账户并**不通用**，请确保当前激活的版本是正确的。插件默认激活的是**英文版**。\n\n---\n\n### 选择题目\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/pick_problem.png\" alt=\"选择题目\" />\n</p>\n\n- 直接点击题目或者在 `LeetCode Explorer` 中**右键**题目并选择 `Preview Problem` 可查看题目描述\n- 选择 `Show Problem` 可直接进行答题。\n\n  > 注意：你可以通过更新配置项 `leetcode.workspaceFolder` 来指定保存题目文件所用的工作区路径。默认工作区路径为：**$HOME/.leetcode/**。\n\n  > 注意：你可以通过更新配置项 `leetcode.showCommentDescription` 来指定是否要在注释中包含题目描述。\n\n  > 注意：你可以通过 `LeetCode: Switch Default Language` 命令变更答题时默认使用编程语言。\n\n---\n\n### 编辑器快捷方式\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/shortcuts.png\" alt=\"Editor Shortcuts\" />\n</p>\n\n- 插件会在编辑区域内支持五种不同的快捷方式（Code Lens）:\n\n  - `Submit`: 提交你的答案至 LeetCode；\n  - `Test`: 用给定的测试用例测试你的答案；\n  - `Star`: 收藏或取消收藏该问题；\n  - `Solution`: 显示该问题的高票解答；\n  - `Description`: 显示该问题的题目描述。\n\n  > 注意：你可以通过 `leetcode.editor.shortcuts` 配置项来定制需要激活的快捷方式。默认情况下只有 `Submit` 和 `Test` 会被激活。\n\n---\n\n### 通过关键字搜索题目\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/search.png\" alt=\"通过关键字搜索题目\" />\n</p>\n\n- 点击 `LeetCode Explorer` 导航栏中的 ![btn_search](https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/btn_search.png) 按钮可按照关键字搜索题目。\n\n---\n\n### 管理存档\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/LeetCode-OpenSource/vscode-leetcode/master/docs/imgs/session.png\" alt=\"管理存档\" />\n</p>\n\n- 点击位于 VS Code 底部状态栏的 `LeetCode: ***` 管理 `LeetCode 存档`。你可以**切换**存档或者**创建**，**删除**存档。\n\n## 插件配置项\n\n| 配置项名称                        | 描述                                                                                                                                                                                                                                                                                                          | 默认值             |\n| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |\n| `leetcode.hideSolved`             | 指定是否要隐藏已解决的问题                                                                                                                                                                                                                                                                                    | `false`            |\n| `leetcode.defaultLanguage`        | 指定答题时使用的默认语言，可选语言有：`bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `php`, `python`,`python3`,`ruby`, `rust`, `scala`, `swift`, `typescript`                                                                                                               | `N/A`              |\n| `leetcode.useWsl`                 | 指定是否启用 WSL                                                                                                                                                                                                                                                                                              | `false`            |\n| `leetcode.endpoint`               | 指定使用的终端，可用终端有：`leetcode`, `leetcode-cn`                                                                                                                                                                                                                                                         | `leetcode`         |\n| `leetcode.workspaceFolder`        | 指定保存文件的工作区目录                                                                                                                                                                                                                                                                                      | `\"\"`               |\n| `leetcode.filePath`               | 指定生成题目文件的相对文件夹路径名和文件名。点击查看[更多详细用法](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%98%E7%9B%AE%E6%96%87%E4%BB%B6%E7%9A%84%E7%9B%B8%E5%AF%B9%E6%96%87%E4%BB%B6%E5%A4%B9%E8%B7%AF%E5%BE%84%E5%92%8C%E6%96%87%E4%BB%B6%E5%90%8D)。 |                    |\n| `leetcode.enableStatusBar`        | 指定是否在 VS Code 下方显示插件状态栏。                                                                                                                                                                                                                                                                       | `true`             |\n| `leetcode.editor.shortcuts`       | 指定在编辑器内所自定义的快捷方式。可用的快捷方式有: `submit`, `test`, `star`, `solution`, `description`。                                                                                                                                                                                                     | `[\"submit, test\"]` |\n| `leetcode.enableSideMode`         | 指定在解决一道题时，是否将`问题预览`、`高票答案`与`提交结果`窗口集中在编辑器的第二栏。                                                                                                                                                                                                                        | `true`             |\n| `leetcode.nodePath`               | 指定 `Node.js` 可执行文件的路径。如：C:\\Program Files\\nodejs\\node.exe                                                                                                                                                                                                                                         | `node`             |\n| `leetcode.showCommentDescription` | 指定是否要在注释中显示题干。                                                                                                                                                                                                                                                                                  | `false`            |\n| `leetcode.useEndpointTranslation` | 是否显示翻译版本内容。                                                                                                                                                                                                                                                                                        | `true`             |\n| `leetcode.allowReportData`        | 为了更好的产品体验允许上报用户埋数据                                                                                                                                                                                                                                                                          | `true`             |\n\n## 需要帮助？\n\n在遇到任何问题时，可以先查看一下[疑难解答](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/%E7%96%91%E9%9A%BE%E8%A7%A3%E7%AD%94)以及[常见问题](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)寻求帮助。\n\n如果您的问题依然没有解决，可以在 [Gitter Channel](https://gitter.im/vscode-leetcode/Lobby) 联系我们，或者您也可以[记录一个新的 issue](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/new/choose)。\n\n## 更新日志\n\n请参考[更新日志](https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/CHANGELOG.md)\n\n## 鸣谢\n\n- 本插件基于[@skygragon](https://github.com/skygragon)的[leetcode-cli](https://github.com/skygragon/leetcode-cli)开源项目制作。\n- 特别鸣谢这些[贡献者们](https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/ACKNOWLEDGEMENTS.md)。\n"
  },
  {
    "path": "package.json",
    "content": "{\n    \"name\": \"vscode-leetcode\",\n    \"displayName\": \"LeetCode\",\n    \"description\": \"Solve LeetCode problems in VS Code\",\n    \"version\": \"0.18.4\",\n    \"author\": \"LeetCode\",\n    \"publisher\": \"LeetCode\",\n    \"license\": \"MIT\",\n    \"icon\": \"resources/LeetCode.png\",\n    \"engines\": {\n        \"vscode\": \"^1.57.0\"\n    },\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/LeetCode-OpenSource/vscode-leetcode\"\n    },\n    \"homepage\": \"https://github.com/LeetCode-OpenSource/vscode-leetcode/blob/master/README.md\",\n    \"categories\": [\n        \"Other\",\n        \"Snippets\"\n    ],\n    \"keywords\": [\n        \"leetcode\",\n        \"algorithm\",\n        \"interview\"\n    ],\n    \"preview\": true,\n    \"activationEvents\": [\n        \"onCommand:leetcode.toggleLeetCodeCn\",\n        \"onCommand:leetcode.signin\",\n        \"onCommand:leetcode.signout\",\n        \"onCommand:leetcode.manageSessions\",\n        \"onCommand:leetcode.refreshExplorer\",\n        \"onCommand:leetcode.pickOne\",\n        \"onCommand:leetcode.showProblem\",\n        \"onCommand:leetcode.previewProblem\",\n        \"onCommand:leetcode.searchProblem\",\n        \"onCommand:leetcode.testSolution\",\n        \"onCommand:leetcode.submitSolution\",\n        \"onCommand:leetcode.switchDefaultLanguage\",\n        \"onCommand:leetcode.problems.sort\",\n        \"onView:leetCodeExplorer\"\n    ],\n    \"main\": \"./out/src/extension\",\n    \"contributes\": {\n        \"commands\": [\n            {\n                \"command\": \"leetcode.deleteCache\",\n                \"title\": \"Delete Cache\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.toggleLeetCodeCn\",\n                \"title\": \"Switch Endpoint\",\n                \"category\": \"LeetCode\",\n                \"icon\": \"$(globe)\"\n            },\n            {\n                \"command\": \"leetcode.signin\",\n                \"title\": \"Sign In\",\n                \"category\": \"LeetCode\",\n                \"icon\": \"$(sign-in)\"\n            },\n            {\n                \"command\": \"leetcode.signout\",\n                \"title\": \"Sign Out\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.manageSessions\",\n                \"title\": \"Manage Sessions\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.refreshExplorer\",\n                \"title\": \"Refresh\",\n                \"category\": \"LeetCode\",\n                \"icon\": \"$(refresh)\"\n            },\n            {\n                \"command\": \"leetcode.pickOne\",\n                \"title\": \"Pick One\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.showProblem\",\n                \"title\": \"Show Problem\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.previewProblem\",\n                \"title\": \"Preview Problem\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.searchProblem\",\n                \"title\": \"Search Problem\",\n                \"category\": \"LeetCode\",\n                \"icon\": \"$(search)\"\n            },\n            {\n                \"command\": \"leetcode.showSolution\",\n                \"title\": \"Show Top Voted Solution\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.testSolution\",\n                \"title\": \"Test in LeetCode\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.submitSolution\",\n                \"title\": \"Submit to LeetCode\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.addFavorite\",\n                \"title\": \"Add to Favorite List\",\n                \"category\": \"LeetCode\",\n                \"icon\": {\n                    \"light\": \"resources/light/like.png\",\n                    \"dark\": \"resources/dark/like.png\"\n                }\n            },\n            {\n                \"command\": \"leetcode.removeFavorite\",\n                \"title\": \"Remove from Favorite List\",\n                \"category\": \"LeetCode\",\n                \"icon\": {\n                    \"light\": \"resources/light/dislike.png\",\n                    \"dark\": \"resources/dark/dislike.png\"\n                }\n            },\n            {\n                \"command\": \"leetcode.switchDefaultLanguage\",\n                \"title\": \"Switch Default Language\",\n                \"category\": \"LeetCode\"\n            },\n            {\n                \"command\": \"leetcode.problems.sort\",\n                \"title\": \"Sort Problems\",\n                \"category\": \"LeetCode\",\n                \"icon\": \"$(sort-precedence)\"\n            }\n        ],\n        \"viewsContainers\": {\n            \"activitybar\": [\n                {\n                    \"id\": \"leetcode\",\n                    \"title\": \"LeetCode\",\n                    \"icon\": \"resources/LeetCode.svg\"\n                }\n            ]\n        },\n        \"views\": {\n            \"leetcode\": [\n                {\n                    \"id\": \"leetCodeExplorer\",\n                    \"name\": \"Problems\"\n                }\n            ]\n        },\n        \"menus\": {\n            \"view/title\": [\n                {\n                    \"command\": \"leetcode.toggleLeetCodeCn\",\n                    \"when\": \"view == leetCodeExplorer\",\n                    \"group\": \"navigation@0\"\n                },\n                {\n                    \"command\": \"leetcode.signin\",\n                    \"when\": \"view == leetCodeExplorer\",\n                    \"group\": \"navigation@1\"\n                },\n                {\n                    \"command\": \"leetcode.searchProblem\",\n                    \"when\": \"view == leetCodeExplorer\",\n                    \"group\": \"navigation@2\"\n                },\n                {\n                    \"command\": \"leetcode.refreshExplorer\",\n                    \"when\": \"view == leetCodeExplorer\",\n                    \"group\": \"navigation@3\"\n                },\n                {\n                    \"command\": \"leetcode.signout\",\n                    \"when\": \"view == leetCodeExplorer\",\n                    \"group\": \"overflow@1\"\n                },\n                {\n                    \"command\": \"leetcode.pickOne\",\n                    \"when\": \"view == leetCodeExplorer\",\n                    \"group\": \"overflow@2\"\n                },\n                {\n                    \"command\": \"leetcode.problems.sort\",\n                    \"when\": \"view == leetCodeExplorer\",\n                    \"group\": \"overflow@3\"\n                }\n            ],\n            \"view/item/context\": [\n                {\n                    \"command\": \"leetcode.previewProblem\",\n                    \"when\": \"view == leetCodeExplorer && viewItem =~ /problem*/\",\n                    \"group\": \"leetcode@1\"\n                },\n                {\n                    \"command\": \"leetcode.showProblem\",\n                    \"when\": \"view == leetCodeExplorer && viewItem =~ /problem*/\",\n                    \"group\": \"leetcode@2\"\n                },\n                {\n                    \"command\": \"leetcode.showSolution\",\n                    \"when\": \"view == leetCodeExplorer && viewItem =~ /problem*/\",\n                    \"group\": \"leetcode@3\"\n                },\n                {\n                    \"command\": \"leetcode.addFavorite\",\n                    \"when\": \"view == leetCodeExplorer && viewItem == problem\",\n                    \"group\": \"inline\"\n                },\n                {\n                    \"command\": \"leetcode.removeFavorite\",\n                    \"when\": \"view == leetCodeExplorer && viewItem == problem-favorite\",\n                    \"group\": \"inline\"\n                }\n            ],\n            \"commandPalette\": [\n                {\n                    \"command\": \"leetcode.showProblem\",\n                    \"when\": \"never\"\n                },\n                {\n                    \"command\": \"leetcode.showSolution\",\n                    \"when\": \"never\"\n                },\n                {\n                    \"command\": \"leetcode.previewProblem\",\n                    \"when\": \"never\"\n                },\n                {\n                    \"command\": \"leetcode.addFavorite\",\n                    \"when\": \"never\"\n                },\n                {\n                    \"command\": \"leetcode.removeFavorite\",\n                    \"when\": \"never\"\n                }\n            ],\n            \"explorer/context\": [\n                {\n                    \"command\": \"leetcode.testSolution\",\n                    \"when\": \"explorerResourceIsFolder == false\",\n                    \"group\": \"leetcode@1\"\n                },\n                {\n                    \"command\": \"leetcode.submitSolution\",\n                    \"when\": \"explorerResourceIsFolder == false\",\n                    \"group\": \"leetcode@2\"\n                }\n            ],\n            \"editor/context\": [\n                {\n                    \"submenu\": \"leetcode.editorAction\"\n                }\n            ],\n            \"leetcode.editorAction\": [\n                {\n                    \"command\": \"leetcode.testSolution\",\n                    \"group\": \"leetcode@1\"\n                },\n                {\n                    \"command\": \"leetcode.submitSolution\",\n                    \"group\": \"leetcode@2\"\n                },\n                {\n                    \"command\": \"leetcode.showSolution\",\n                    \"group\": \"leetcode@3\"\n                },\n                {\n                    \"command\": \"leetcode.previewProblem\",\n                    \"group\": \"leetcode@4\"\n                }\n            ]\n        },\n        \"submenus\": [\n            {\n                \"id\": \"leetcode.editorAction\",\n                \"label\": \"LeetCode\"\n            }\n        ],\n        \"configuration\": [\n            {\n                \"title\": \"LeetCode\",\n                \"properties\": {\n                    \"leetcode.hideSolved\": {\n                        \"type\": \"boolean\",\n                        \"default\": false,\n                        \"scope\": \"application\",\n                        \"description\": \"Hide solved problems.\"\n                    },\n                    \"leetcode.defaultLanguage\": {\n                        \"type\": \"string\",\n                        \"enum\": [\n                            \"bash\",\n                            \"c\",\n                            \"cpp\",\n                            \"csharp\",\n                            \"golang\",\n                            \"java\",\n                            \"javascript\",\n                            \"kotlin\",\n                            \"mysql\",\n                            \"php\",\n                            \"python\",\n                            \"python3\",\n                            \"ruby\",\n                            \"rust\",\n                            \"scala\",\n                            \"swift\",\n                            \"typescript\"\n                        ],\n                        \"scope\": \"application\",\n                        \"description\": \"Default language for solving the problems.\"\n                    },\n                    \"leetcode.showDescription\": {\n                        \"type\": \"string\",\n                        \"default\": \"In Webview\",\n                        \"enum\": [\n                            \"In Webview\",\n                            \"In File Comment\",\n                            \"Both\",\n                            \"None\"\n                        ],\n                        \"enumDescriptions\": [\n                            \"Show the problem description in a new webview window\",\n                            \"Show the problem description in the file's comment\"\n                        ],\n                        \"scope\": \"application\",\n                        \"description\": \"Specify where to show the description.\"\n                    },\n                    \"leetcode.showCommentDescription\": {\n                        \"type\": \"boolean\",\n                        \"default\": false,\n                        \"scope\": \"application\",\n                        \"description\": \"[Deprecated] Include problem description in comments.\",\n                        \"deprecationMessage\": \"This setting will be deprecated in 0.17.0, please use 'leetcode.showDescription' instead\"\n                    },\n                    \"leetcode.hint.setDefaultLanguage\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Show a hint to set the default language.\"\n                    },\n                    \"leetcode.hint.configWebviewMarkdown\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Show a hint to change webview appearance through markdown config.\"\n                    },\n                    \"leetcode.hint.commentDescription\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Show a hint to enable comment description in solution code file.\"\n                    },\n                    \"leetcode.hint.commandShortcut\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Show a hint to configure commands key binding.\"\n                    },\n                    \"leetcode.useWsl\": {\n                        \"type\": \"boolean\",\n                        \"default\": false,\n                        \"scope\": \"application\",\n                        \"description\": \"Use the Windows Subsystem for Linux.\"\n                    },\n                    \"leetcode.endpoint\": {\n                        \"type\": \"string\",\n                        \"default\": \"leetcode\",\n                        \"scope\": \"application\",\n                        \"enum\": [\n                            \"leetcode\",\n                            \"leetcode-cn\"\n                        ],\n                        \"description\": \"Endpoint of the user account.\"\n                    },\n                    \"leetcode.useEndpointTranslation\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Use endpoint's translation (if available)\"\n                    },\n                    \"leetcode.workspaceFolder\": {\n                        \"type\": \"string\",\n                        \"scope\": \"application\",\n                        \"description\": \"The path of the workspace folder to store the problem files.\",\n                        \"default\": \"\"\n                    },\n                    \"leetcode.filePath\": {\n                        \"type\": \"object\",\n                        \"scope\": \"application\",\n                        \"description\": \"The output folder and filename to save the problem files.\",\n                        \"properties\": {\n                            \"default\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\",\n                                        \"examples\": [\n                                            \"src\"\n                                        ]\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\",\n                                        \"examples\": [\n                                            \"${camelCaseName}.${ext}\",\n                                            \"${PascalCaseName}.${ext}\",\n                                            \"${id}-${kebab-case-name}.${ext}\",\n                                            \"${id}_${snake_case_name}.${ext}\"\n                                        ]\n                                    }\n                                },\n                                \"required\": [\n                                    \"folder\",\n                                    \"filename\"\n                                ]\n                            },\n                            \"bash\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"c\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"cpp\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"csharp\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"golang\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"java\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"javascript\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"kotlin\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"mysql\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"php\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"python\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"python3\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"ruby\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"rust\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"scala\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            },\n                            \"swift\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"folder\": {\n                                        \"type\": \"string\"\n                                    },\n                                    \"filename\": {\n                                        \"type\": \"string\"\n                                    }\n                                },\n                                \"minProperties\": 1\n                            }\n                        },\n                        \"additionalProperties\": {\n                            \"type\": \"object\",\n                            \"properties\": {\n                                \"folder\": {\n                                    \"type\": \"string\"\n                                },\n                                \"filename\": {\n                                    \"type\": \"string\"\n                                }\n                            },\n                            \"minProperties\": 1\n                        },\n                        \"default\": {\n                            \"default\": {\n                                \"folder\": \"\",\n                                \"filename\": \"${id}.${kebab-case-name}.${ext}\"\n                            }\n                        }\n                    },\n                    \"leetcode.enableStatusBar\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Show the LeetCode status bar or not.\"\n                    },\n                    \"leetcode.editor.shortcuts\": {\n                        \"type\": \"array\",\n                        \"default\": [\n                            \"submit\",\n                            \"test\"\n                        ],\n                        \"scope\": \"application\",\n                        \"items\": {\n                            \"type\": \"string\",\n                            \"enum\": [\n                                \"submit\",\n                                \"test\",\n                                \"star\",\n                                \"solution\",\n                                \"description\"\n                            ],\n                            \"enumDescriptions\": [\n                                \"Submit your answer to LeetCode.\",\n                                \"Test your answer with customized test cases.\",\n                                \"Star or unstar the current problem.\",\n                                \"Show the top voted solution for the current problem.\",\n                                \"Show the problem description page.\"\n                            ]\n                        },\n                        \"description\": \"Customize the shortcuts in editors.\"\n                    },\n                    \"leetcode.enableSideMode\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Determine whether to group all webview pages into the second editor column when solving problems.\"\n                    },\n                    \"leetcode.nodePath\": {\n                        \"type\": \"string\",\n                        \"default\": \"node\",\n                        \"scope\": \"application\",\n                        \"description\": \"The Node.js executable path. for example, C:\\\\Program Files\\\\nodejs\\\\node.exe\"\n                    },\n                    \"leetcode.colorizeProblems\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Add difficulty badge and colorize problems files in explorer tree.\"\n                    },\n                    \"leetcode.problems.sortStrategy\": {\n                        \"type\": \"string\",\n                        \"default\": \"None\",\n                        \"scope\": \"application\",\n                        \"enum\": [\n                            \"None\",\n                            \"Acceptance Rate (Ascending)\",\n                            \"Acceptance Rate (Descending)\"\n                        ],\n                        \"description\": \"Sorting strategy for problems list.\"\n                    },\n                    \"leetcode.allowReportData\": {\n                        \"type\": \"boolean\",\n                        \"default\": true,\n                        \"scope\": \"application\",\n                        \"description\": \"Allow LeetCode to report anonymous usage data to improve the product.\"\n                    }\n                }\n            }\n        ]\n    },\n    \"scripts\": {\n        \"vscode:prepublish\": \"npm run compile\",\n        \"compile\": \"tsc -p ./\",\n        \"watch\": \"tsc -watch -p ./\",\n        \"lint\": \"tslint --project tsconfig.json -e src/*.d.ts -t verbose\",\n        \"build\": \"vsce package\",\n        \"vs-publish\": \"vsce publish\"\n    },\n    \"devDependencies\": {\n        \"@types/fs-extra\": \"^9.0.11\",\n        \"@types/lodash\": \"^4.14.170\",\n        \"@types/markdown-it\": \"0.0.7\",\n        \"@types/mocha\": \"^2.2.42\",\n        \"@types/node\": \"^14.14.33\",\n        \"@types/require-from-string\": \"^1.2.0\",\n        \"@types/vscode\": \"1.57.0\",\n        \"tslint\": \"^5.20.1\",\n        \"typescript\": \"^4.3.2\"\n    },\n    \"dependencies\": {\n        \"axios\": \"^1.6.8\",\n        \"fs-extra\": \"^10.0.0\",\n        \"highlight.js\": \"^10.7.2\",\n        \"lodash\": \"^4.17.21\",\n        \"markdown-it\": \"^8.4.2\",\n        \"require-from-string\": \"^2.0.2\",\n        \"unescape-js\": \"^1.1.4\",\n        \"vsc-leetcode-cli\": \"2.8.1\"\n    }\n}\n"
  },
  {
    "path": "src/codelens/CodeLensController.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { ConfigurationChangeEvent, Disposable, languages, workspace } from \"vscode\";\nimport { customCodeLensProvider, CustomCodeLensProvider } from \"./CustomCodeLensProvider\";\n\nclass CodeLensController implements Disposable {\n    private internalProvider: CustomCodeLensProvider;\n    private registeredProvider: Disposable | undefined;\n    private configurationChangeListener: Disposable;\n\n    constructor() {\n        this.internalProvider = customCodeLensProvider;\n\n        this.configurationChangeListener = workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {\n            if (event.affectsConfiguration(\"leetcode.editor.shortcuts\")) {\n                this.internalProvider.refresh();\n            }\n        }, this);\n\n        this.registeredProvider = languages.registerCodeLensProvider({ scheme: \"file\" }, this.internalProvider);\n    }\n\n    public dispose(): void {\n        if (this.registeredProvider) {\n            this.registeredProvider.dispose();\n        }\n        this.configurationChangeListener.dispose();\n    }\n}\n\nexport const codeLensController: CodeLensController = new CodeLensController();\n"
  },
  {
    "path": "src/codelens/CustomCodeLensProvider.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { explorerNodeManager } from \"../explorer/explorerNodeManager\";\nimport { LeetCodeNode } from \"../explorer/LeetCodeNode\";\nimport { getEditorShortcuts } from \"../utils/settingUtils\";\n\nexport class CustomCodeLensProvider implements vscode.CodeLensProvider {\n\n    private onDidChangeCodeLensesEmitter: vscode.EventEmitter<void> = new vscode.EventEmitter<void>();\n\n    get onDidChangeCodeLenses(): vscode.Event<void> {\n        return this.onDidChangeCodeLensesEmitter.event;\n    }\n\n    public refresh(): void {\n        this.onDidChangeCodeLensesEmitter.fire();\n    }\n\n    public provideCodeLenses(document: vscode.TextDocument): vscode.ProviderResult<vscode.CodeLens[]> {\n        const shortcuts: string[] = getEditorShortcuts();\n        if (!shortcuts) {\n            return;\n        }\n\n        const content: string = document.getText();\n        const matchResult: RegExpMatchArray | null = content.match(/@lc app=.* id=(.*) lang=.*/);\n        if (!matchResult) {\n            return undefined;\n        }\n        const nodeId: string | undefined = matchResult[1];\n        let node: LeetCodeNode | undefined;\n        if (nodeId) {\n            node = explorerNodeManager.getNodeById(nodeId);\n        }\n\n        let codeLensLine: number = document.lineCount - 1;\n        for (let i: number = document.lineCount - 1; i >= 0; i--) {\n            const lineContent: string = document.lineAt(i).text;\n            if (lineContent.indexOf(\"@lc code=end\") >= 0) {\n                codeLensLine = i;\n                break;\n            }\n        }\n\n        const range: vscode.Range = new vscode.Range(codeLensLine, 0, codeLensLine, 0);\n        const codeLens: vscode.CodeLens[] = [];\n\n        if (shortcuts.indexOf(\"submit\") >= 0) {\n            codeLens.push(new vscode.CodeLens(range, {\n                title: \"Submit\",\n                command: \"leetcode.submitSolution\",\n                arguments: [document.uri],\n            }));\n        }\n\n        if (shortcuts.indexOf(\"test\") >= 0) {\n            codeLens.push(new vscode.CodeLens(range, {\n                title: \"Test\",\n                command: \"leetcode.testSolution\",\n                arguments: [document.uri],\n            }));\n        }\n\n        if (shortcuts.indexOf(\"star\") >= 0 && node) {\n            codeLens.push(new vscode.CodeLens(range, {\n                title: node.isFavorite ? \"Unstar\" : \"Star\",\n                command: node.isFavorite ? \"leetcode.removeFavorite\" : \"leetcode.addFavorite\",\n                arguments: [node],\n            }));\n        }\n\n        if (shortcuts.indexOf(\"solution\") >= 0) {\n            codeLens.push(new vscode.CodeLens(range, {\n                title: \"Solution\",\n                command: \"leetcode.showSolution\",\n                arguments: [document.uri],\n            }));\n        }\n\n        if (shortcuts.indexOf(\"description\") >= 0) {\n            codeLens.push(new vscode.CodeLens(range, {\n                title: \"Description\",\n                command: \"leetcode.previewProblem\",\n                arguments: [document.uri],\n            }));\n        }\n\n        return codeLens;\n    }\n}\n\nexport const customCodeLensProvider: CustomCodeLensProvider = new CustomCodeLensProvider();\n"
  },
  {
    "path": "src/commands/cache.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { DialogType, promptForOpenOutputChannel } from \"../utils/uiUtils\";\n\nexport async function deleteCache(): Promise<void> {\n    try {\n        await leetCodeExecutor.deleteCache();\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to delete cache. Please open the output channel for details.\", DialogType.error);\n    }\n}\n"
  },
  {
    "path": "src/commands/language.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { QuickPickItem, window, workspace, WorkspaceConfiguration } from \"vscode\";\nimport { languages } from \"../shared\";\n\nexport async function switchDefaultLanguage(): Promise<void> {\n    const leetCodeConfig: WorkspaceConfiguration = workspace.getConfiguration(\"leetcode\");\n    const defaultLanguage: string | undefined = leetCodeConfig.get<string>(\"defaultLanguage\");\n    const languageItems: QuickPickItem[] = [];\n    for (const language of languages) {\n        languageItems.push({\n            label: language,\n            description: defaultLanguage === language ? \"Currently used\" : undefined,\n        });\n    }\n    // Put the default language at the top of the list\n    languageItems.sort((a: QuickPickItem, b: QuickPickItem) => {\n        if (a.description) {\n            return Number.MIN_SAFE_INTEGER;\n        } else if (b.description) {\n            return Number.MAX_SAFE_INTEGER;\n        }\n        return a.label.localeCompare(b.label);\n    });\n\n    const selectedItem: QuickPickItem | undefined = await window.showQuickPick(languageItems, {\n        placeHolder: \"Please the default language\",\n        ignoreFocusOut: true,\n    });\n\n    if (!selectedItem) {\n        return;\n    }\n\n    leetCodeConfig.update(\"defaultLanguage\", selectedItem.label, true /* Global */);\n    window.showInformationMessage(`Successfully set the default language to ${selectedItem.label}`);\n}\n"
  },
  {
    "path": "src/commands/list.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { leetCodeManager } from \"../leetCodeManager\";\nimport { IProblem, ProblemState, UserStatus } from \"../shared\";\nimport * as settingUtils from \"../utils/settingUtils\";\nimport { DialogType, promptForOpenOutputChannel } from \"../utils/uiUtils\";\n\nexport async function listProblems(): Promise<IProblem[]> {\n    try {\n        if (leetCodeManager.getStatus() === UserStatus.SignedOut) {\n            return [];\n        }\n\n        const useEndpointTranslation: boolean = settingUtils.shouldUseEndpointTranslation();\n        const result: string = await leetCodeExecutor.listProblems(true, useEndpointTranslation);\n        const problems: IProblem[] = [];\n        const lines: string[] = result.split(\"\\n\");\n        const reg: RegExp = /^(.)\\s(.{1,2})\\s(.)\\s\\[\\s*(\\d*)\\s*\\]\\s*(.*)\\s*(Easy|Medium|Hard)\\s*\\((\\s*\\d+\\.\\d+ %)\\)/;\n        const { companies, tags } = await leetCodeExecutor.getCompaniesAndTags();\n        for (const line of lines) {\n            const match: RegExpMatchArray | null = line.match(reg);\n            if (match && match.length === 8) {\n                const id: string = match[4].trim();\n                problems.push({\n                    id,\n                    isFavorite: match[1].trim().length > 0,\n                    locked: match[2].trim().length > 0,\n                    state: parseProblemState(match[3]),\n                    name: match[5].trim(),\n                    difficulty: match[6].trim(),\n                    passRate: match[7].trim(),\n                    companies: companies[id] || [\"Unknown\"],\n                    tags: tags[id] || [\"Unknown\"],\n                });\n            }\n        }\n        return problems.reverse();\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to list problems. Please open the output channel for details.\", DialogType.error);\n        return [];\n    }\n}\n\nfunction parseProblemState(stateOutput: string): ProblemState {\n    if (!stateOutput) {\n        return ProblemState.Unknown;\n    }\n    switch (stateOutput.trim()) {\n        case \"v\":\n        case \"✔\":\n        case \"√\":\n            return ProblemState.AC;\n        case \"X\":\n        case \"✘\":\n        case \"×\":\n            return ProblemState.NotAC;\n        default:\n            return ProblemState.Unknown;\n    }\n}\n"
  },
  {
    "path": "src/commands/plugin.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { leetCodeTreeDataProvider } from \"../explorer/LeetCodeTreeDataProvider\";\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { IQuickItemEx } from \"../shared\";\nimport { Endpoint, SortingStrategy } from \"../shared\";\nimport { DialogType, promptForOpenOutputChannel, promptForSignIn } from \"../utils/uiUtils\";\nimport { deleteCache } from \"./cache\";\n\nexport async function switchEndpoint(): Promise<void> {\n    const isCnEnabled: boolean = getLeetCodeEndpoint() === Endpoint.LeetCodeCN;\n    const picks: Array<IQuickItemEx<string>> = [];\n    picks.push(\n        {\n            label: `${isCnEnabled ? \"\" : \"$(check) \"}LeetCode`,\n            description: \"leetcode.com\",\n            detail: `Enable LeetCode US`,\n            value: Endpoint.LeetCode,\n        },\n        {\n            label: `${isCnEnabled ? \"$(check) \" : \"\"}力扣`,\n            description: \"leetcode.cn\",\n            detail: `启用中国版 LeetCode`,\n            value: Endpoint.LeetCodeCN,\n        },\n    );\n    const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick(picks);\n    if (!choice || choice.value === getLeetCodeEndpoint()) {\n        return;\n    }\n    const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n    try {\n        const endpoint: string = choice.value;\n        await leetCodeExecutor.switchEndpoint(endpoint);\n        await leetCodeConfig.update(\"endpoint\", endpoint, true /* UserSetting */);\n        vscode.window.showInformationMessage(`Switched the endpoint to ${endpoint}`);\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to switch endpoint. Please open the output channel for details.\", DialogType.error);\n    }\n\n    try {\n        await vscode.commands.executeCommand(\"leetcode.signout\");\n        await deleteCache();\n        await promptForSignIn();\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to sign in. Please open the output channel for details.\", DialogType.error);\n    }\n}\n\nexport function getLeetCodeEndpoint(): string {\n    const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n    return leetCodeConfig.get<string>(\"endpoint\", Endpoint.LeetCode);\n}\n\nconst SORT_ORDER: SortingStrategy[] = [\n    SortingStrategy.None,\n    SortingStrategy.AcceptanceRateAsc,\n    SortingStrategy.AcceptanceRateDesc,\n];\n\nexport async function switchSortingStrategy(): Promise<void> {\n    const currentStrategy: SortingStrategy = getSortingStrategy();\n    const picks: Array<IQuickItemEx<string>> = [];\n    picks.push(\n        ...SORT_ORDER.map((s: SortingStrategy) => {\n            return {\n                label: `${currentStrategy === s ? \"$(check)\" : \"    \"} ${s}`,\n                value: s,\n            };\n        }),\n    );\n\n    const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick(picks);\n    if (!choice || choice.value === currentStrategy) {\n        return;\n    }\n\n    const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n    await leetCodeConfig.update(\"problems.sortStrategy\", choice.value, true);\n    await leetCodeTreeDataProvider.refresh();\n}\n\nexport function getSortingStrategy(): SortingStrategy {\n    const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n    return leetCodeConfig.get<SortingStrategy>(\"problems.sortStrategy\", SortingStrategy.None);\n}\n"
  },
  {
    "path": "src/commands/session.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { leetCodeManager } from \"../leetCodeManager\";\nimport { IQuickItemEx } from \"../shared\";\nimport { DialogOptions, DialogType, promptForOpenOutputChannel, promptForSignIn } from \"../utils/uiUtils\";\n\nexport async function getSessionList(): Promise<ISession[]> {\n    const signInStatus: string | undefined = leetCodeManager.getUser();\n    if (!signInStatus) {\n        promptForSignIn();\n        return [];\n    }\n    const result: string = await leetCodeExecutor.listSessions();\n    const lines: string[] = result.split(\"\\n\");\n    const sessions: ISession[] = [];\n    const reg: RegExp = /(.?)\\s*(\\d+)\\s+(.*)\\s+(\\d+ \\(\\s*\\d+\\.\\d+ %\\))\\s+(\\d+ \\(\\s*\\d+\\.\\d+ %\\))/;\n    for (const line of lines) {\n        const match: RegExpMatchArray | null = line.match(reg);\n        if (match && match.length === 6) {\n            sessions.push({\n                active: !!(match[1].trim()),\n                id: match[2].trim(),\n                name: match[3].trim(),\n                acQuestions: match[4].trim(),\n                acSubmits: match[5].trim(),\n            });\n        }\n    }\n    return sessions;\n}\n\nexport async function manageSessions(): Promise<void> {\n    const choice: IQuickItemEx<ISession | string> | undefined = await vscode.window.showQuickPick(parseSessionsToPicks(true /* includeOperation */));\n    if (!choice || choice.description === \"Active\") {\n        return;\n    }\n    if (choice.value === \":createSession\") {\n        await createSession();\n        return;\n    }\n    if (choice.value === \":deleteSession\") {\n        await deleteSession();\n        return;\n    }\n    try {\n        await leetCodeExecutor.enableSession((choice.value as ISession).id);\n        vscode.window.showInformationMessage(`Successfully switched to session '${choice.label}'.`);\n        await vscode.commands.executeCommand(\"leetcode.refreshExplorer\");\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to switch session. Please open the output channel for details.\", DialogType.error);\n    }\n}\n\nasync function parseSessionsToPicks(includeOperations: boolean = false): Promise<Array<IQuickItemEx<ISession | string>>> {\n    return new Promise(async (resolve: (res: Array<IQuickItemEx<ISession | string>>) => void): Promise<void> => {\n        try {\n            const sessions: ISession[] = await getSessionList();\n            const picks: Array<IQuickItemEx<ISession | string>> = sessions.map((s: ISession) => Object.assign({}, {\n                label: `${s.active ? \"$(check) \" : \"\"}${s.name}`,\n                description: s.active ? \"Active\" : \"\",\n                detail: `AC Questions: ${s.acQuestions}, AC Submits: ${s.acSubmits}`,\n                value: s,\n            }));\n\n            if (includeOperations) {\n                picks.push(...parseSessionManagementOperations());\n            }\n            resolve(picks);\n        } catch (error) {\n            return await promptForOpenOutputChannel(\"Failed to list sessions. Please open the output channel for details.\", DialogType.error);\n        }\n    });\n}\n\nfunction parseSessionManagementOperations(): Array<IQuickItemEx<string>> {\n    return [{\n        label: \"$(plus) Create a session\",\n        description: \"\",\n        detail: \"Click this item to create a session\",\n        value: \":createSession\",\n    }, {\n        label: \"$(trashcan) Delete a session\",\n        description: \"\",\n        detail: \"Click this item to DELETE a session\",\n        value: \":deleteSession\",\n    }];\n}\n\nasync function createSession(): Promise<void> {\n    const session: string | undefined = await vscode.window.showInputBox({\n        prompt: \"Enter the new session name.\",\n        validateInput: (s: string): string | undefined => s && s.trim() ? undefined : \"Session name must not be empty\",\n    });\n    if (!session) {\n        return;\n    }\n    try {\n        await leetCodeExecutor.createSession(session);\n        vscode.window.showInformationMessage(\"New session created, you can switch to it by clicking the status bar.\");\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to create session. Please open the output channel for details.\", DialogType.error);\n    }\n}\n\nasync function deleteSession(): Promise<void> {\n    const choice: IQuickItemEx<ISession | string> | undefined = await vscode.window.showQuickPick(\n        parseSessionsToPicks(false /* includeOperation */),\n        { placeHolder: \"Please select the session you want to delete\" },\n    );\n    if (!choice) {\n        return;\n    }\n\n    const selectedSession: ISession = choice.value as ISession;\n    if (selectedSession.active) {\n        vscode.window.showInformationMessage(\"Cannot delete an active session.\");\n        return;\n    }\n\n    const action: vscode.MessageItem | undefined = await vscode.window.showWarningMessage(\n        `This operation cannot be reverted. Are you sure to delete the session: ${selectedSession.name}?`,\n        DialogOptions.yes,\n        DialogOptions.no,\n    );\n    if (action !== DialogOptions.yes) {\n        return;\n    }\n\n    const confirm: string | undefined = await vscode.window.showInputBox({\n        prompt: \"Enter 'yes' to confirm deleting the session\",\n        validateInput: (value: string): string => {\n            if (value === \"yes\") {\n                return \"\";\n            } else {\n                return \"Enter 'yes' to confirm\";\n            }\n        },\n    });\n\n    if (confirm === \"yes\") {\n        await leetCodeExecutor.deleteSession(selectedSession.id);\n        vscode.window.showInformationMessage(\"The session has been successfully deleted.\");\n    }\n}\n\nexport interface ISession {\n    active: boolean;\n    id: string;\n    name: string;\n    acQuestions: string;\n    acSubmits: string;\n}\n"
  },
  {
    "path": "src/commands/show.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as _ from \"lodash\";\nimport * as path from \"path\";\nimport * as unescapeJS from \"unescape-js\";\nimport * as vscode from \"vscode\";\nimport { explorerNodeManager } from \"../explorer/explorerNodeManager\";\nimport { LeetCodeNode } from \"../explorer/LeetCodeNode\";\nimport { leetCodeChannel } from \"../leetCodeChannel\";\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { leetCodeManager } from \"../leetCodeManager\";\nimport { Endpoint, IProblem, IQuickItemEx, languages, PREMIUM_URL_CN, PREMIUM_URL_GLOBAL, ProblemState } from \"../shared\";\nimport { genFileExt, genFileName, getNodeIdFromFile } from \"../utils/problemUtils\";\nimport * as settingUtils from \"../utils/settingUtils\";\nimport { IDescriptionConfiguration } from \"../utils/settingUtils\";\nimport {\n    DialogOptions,\n    DialogType,\n    openSettingsEditor,\n    openUrl,\n    promptForOpenOutputChannel,\n    promptForSignIn,\n    promptHintMessage,\n} from \"../utils/uiUtils\";\nimport { getActiveFilePath, selectWorkspaceFolder } from \"../utils/workspaceUtils\";\nimport * as wsl from \"../utils/wslUtils\";\nimport { leetCodePreviewProvider } from \"../webview/leetCodePreviewProvider\";\nimport { leetCodeSolutionProvider } from \"../webview/leetCodeSolutionProvider\";\nimport * as list from \"./list\";\nimport { getLeetCodeEndpoint } from \"./plugin\";\nimport { globalState } from \"../globalState\";\n\nexport async function previewProblem(input: IProblem | vscode.Uri, isSideMode: boolean = false): Promise<void> {\n    let node: IProblem;\n\n    if (input instanceof vscode.Uri) {\n        const activeFilePath: string = input.fsPath;\n        const id: string = await getNodeIdFromFile(activeFilePath);\n        if (!id) {\n            vscode.window.showErrorMessage(`Failed to resolve the problem id from file: ${activeFilePath}.`);\n            return;\n        }\n        const cachedNode: IProblem | undefined = explorerNodeManager.getNodeById(id);\n        if (!cachedNode) {\n            vscode.window.showErrorMessage(`Failed to resolve the problem with id: ${id}.`);\n            return;\n        }\n        node = cachedNode;\n        // Move the preview page aside if it's triggered from Code Lens\n        isSideMode = true;\n    } else {\n        node = input;\n        const { isPremium } = globalState.getUserStatus() ?? {};\n        if (input.locked && !isPremium) {\n            const url = getLeetCodeEndpoint() === Endpoint.LeetCode ? PREMIUM_URL_GLOBAL : PREMIUM_URL_CN;\n            openUrl(url);\n            return;\n        }\n    }\n\n    const needTranslation: boolean = settingUtils.shouldUseEndpointTranslation();\n    const descString: string = await leetCodeExecutor.getDescription(node.id, needTranslation);\n    leetCodePreviewProvider.show(descString, node, isSideMode);\n}\n\nexport async function pickOne(): Promise<void> {\n    const problems: IProblem[] = await list.listProblems();\n    const randomProblem: IProblem = problems[Math.floor(Math.random() * problems.length)];\n    await showProblemInternal(randomProblem);\n}\n\nexport async function showProblem(node?: LeetCodeNode): Promise<void> {\n    if (!node) {\n        return;\n    }\n    await showProblemInternal(node);\n}\n\nexport async function searchProblem(): Promise<void> {\n    if (!leetCodeManager.getUser()) {\n        promptForSignIn();\n        return;\n    }\n    const choice: IQuickItemEx<IProblem> | undefined = await vscode.window.showQuickPick(parseProblemsToPicks(list.listProblems()), {\n        matchOnDetail: true,\n        placeHolder: \"Select one problem\",\n    });\n    if (!choice) {\n        return;\n    }\n    await showProblemInternal(choice.value);\n}\n\nexport async function showSolution(input: LeetCodeNode | vscode.Uri): Promise<void> {\n    let problemInput: string | undefined;\n    if (input instanceof LeetCodeNode) {\n        // Triggerred from explorer\n        problemInput = input.id;\n    } else if (input instanceof vscode.Uri) {\n        // Triggerred from Code Lens/context menu\n        problemInput = `\"${input.fsPath}\"`;\n    } else if (!input) {\n        // Triggerred from command\n        problemInput = await getActiveFilePath();\n    }\n\n    if (!problemInput) {\n        vscode.window.showErrorMessage(\"Invalid input to fetch the solution data.\");\n        return;\n    }\n\n    const language: string | undefined = await fetchProblemLanguage();\n    if (!language) {\n        return;\n    }\n    try {\n        const needTranslation: boolean = settingUtils.shouldUseEndpointTranslation();\n        const solution: string = await leetCodeExecutor.showSolution(problemInput, language, needTranslation);\n        leetCodeSolutionProvider.show(unescapeJS(solution));\n    } catch (error) {\n        leetCodeChannel.appendLine(error.toString());\n        await promptForOpenOutputChannel(\"Failed to fetch the top voted solution. Please open the output channel for details.\", DialogType.error);\n    }\n}\n\nasync function fetchProblemLanguage(): Promise<string | undefined> {\n    const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n    let defaultLanguage: string | undefined = leetCodeConfig.get<string>(\"defaultLanguage\");\n    if (defaultLanguage && languages.indexOf(defaultLanguage) < 0) {\n        defaultLanguage = undefined;\n    }\n    const language: string | undefined =\n        defaultLanguage ||\n        (await vscode.window.showQuickPick(languages, {\n            placeHolder: \"Select the language you want to use\",\n            ignoreFocusOut: true,\n        }));\n    // fire-and-forget default language query\n    (async (): Promise<void> => {\n        if (language && !defaultLanguage && leetCodeConfig.get<boolean>(\"hint.setDefaultLanguage\")) {\n            const choice: vscode.MessageItem | undefined = await vscode.window.showInformationMessage(\n                `Would you like to set '${language}' as your default language?`,\n                DialogOptions.yes,\n                DialogOptions.no,\n                DialogOptions.never\n            );\n            if (choice === DialogOptions.yes) {\n                leetCodeConfig.update(\"defaultLanguage\", language, true /* UserSetting */);\n            } else if (choice === DialogOptions.never) {\n                leetCodeConfig.update(\"hint.setDefaultLanguage\", false, true /* UserSetting */);\n            }\n        }\n    })();\n    return language;\n}\n\nasync function showProblemInternal(node: IProblem): Promise<void> {\n    try {\n        const language: string | undefined = await fetchProblemLanguage();\n        if (!language) {\n            return;\n        }\n\n        const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n        const workspaceFolder: string = await selectWorkspaceFolder();\n        if (!workspaceFolder) {\n            return;\n        }\n\n        const fileFolder: string = leetCodeConfig\n            .get<string>(`filePath.${language}.folder`, leetCodeConfig.get<string>(`filePath.default.folder`, \"\"))\n            .trim();\n        const fileName: string = leetCodeConfig\n            .get<string>(`filePath.${language}.filename`, leetCodeConfig.get<string>(`filePath.default.filename`) || genFileName(node, language))\n            .trim();\n\n        let finalPath: string = path.join(workspaceFolder, fileFolder, fileName);\n\n        if (finalPath) {\n            finalPath = await resolveRelativePath(finalPath, node, language);\n            if (!finalPath) {\n                leetCodeChannel.appendLine(\"Showing problem canceled by user.\");\n                return;\n            }\n        }\n\n        finalPath = wsl.useWsl() ? await wsl.toWinPath(finalPath) : finalPath;\n\n        const descriptionConfig: IDescriptionConfiguration = settingUtils.getDescriptionConfiguration();\n        const needTranslation: boolean = settingUtils.shouldUseEndpointTranslation();\n\n        await leetCodeExecutor.showProblem(node, language, finalPath, descriptionConfig.showInComment, needTranslation);\n        const promises: any[] = [\n            vscode.window.showTextDocument(vscode.Uri.file(finalPath), {\n                preview: false,\n                viewColumn: vscode.ViewColumn.One,\n            }),\n            promptHintMessage(\n                \"hint.commentDescription\",\n                'You can config how to show the problem description through \"leetcode.showDescription\".',\n                \"Open settings\",\n                (): Promise<any> => openSettingsEditor(\"leetcode.showDescription\")\n            ),\n        ];\n        if (descriptionConfig.showInWebview) {\n            promises.push(showDescriptionView(node));\n        }\n\n        await Promise.all(promises);\n    } catch (error) {\n        await promptForOpenOutputChannel(`${error} Please open the output channel for details.`, DialogType.error);\n    }\n}\n\nasync function showDescriptionView(node: IProblem): Promise<void> {\n    return previewProblem(node, vscode.workspace.getConfiguration(\"leetcode\").get<boolean>(\"enableSideMode\", true));\n}\nasync function parseProblemsToPicks(p: Promise<IProblem[]>): Promise<Array<IQuickItemEx<IProblem>>> {\n    return new Promise(async (resolve: (res: Array<IQuickItemEx<IProblem>>) => void): Promise<void> => {\n        const picks: Array<IQuickItemEx<IProblem>> = (await p).map((problem: IProblem) =>\n            Object.assign(\n                {},\n                {\n                    label: `${parseProblemDecorator(problem.state, problem.locked)}${problem.id}.${problem.name}`,\n                    description: \"\",\n                    detail: `AC rate: ${problem.passRate}, Difficulty: ${problem.difficulty}`,\n                    value: problem,\n                }\n            )\n        );\n        resolve(picks);\n    });\n}\n\nfunction parseProblemDecorator(state: ProblemState, locked: boolean): string {\n    switch (state) {\n        case ProblemState.AC:\n            return \"$(check) \";\n        case ProblemState.NotAC:\n            return \"$(x) \";\n        default:\n            return locked ? \"$(lock) \" : \"\";\n    }\n}\n\nasync function resolveRelativePath(relativePath: string, node: IProblem, selectedLanguage: string): Promise<string> {\n    let tag: string = \"\";\n    if (/\\$\\{tag\\}/i.test(relativePath)) {\n        tag = (await resolveTagForProblem(node)) || \"\";\n    }\n\n    let company: string = \"\";\n    if (/\\$\\{company\\}/i.test(relativePath)) {\n        company = (await resolveCompanyForProblem(node)) || \"\";\n    }\n\n    return relativePath.replace(/\\$\\{(.*?)\\}/g, (_substring: string, ...args: string[]) => {\n        const placeholder: string = args[0].toLowerCase().trim();\n        switch (placeholder) {\n            case \"id\":\n                return node.id;\n            case \"name\":\n                return node.name;\n            case \"camelcasename\":\n                return _.camelCase(node.name);\n            case \"pascalcasename\":\n                return _.upperFirst(_.camelCase(node.name));\n            case \"kebabcasename\":\n            case \"kebab-case-name\":\n                return _.kebabCase(node.name);\n            case \"snakecasename\":\n            case \"snake_case_name\":\n                return _.snakeCase(node.name);\n            case \"ext\":\n                return genFileExt(selectedLanguage);\n            case \"language\":\n                return selectedLanguage;\n            case \"difficulty\":\n                return node.difficulty.toLocaleLowerCase();\n            case \"tag\":\n                return tag;\n            case \"company\":\n                return company;\n            default:\n                const errorMsg: string = `The config '${placeholder}' is not supported.`;\n                leetCodeChannel.appendLine(errorMsg);\n                throw new Error(errorMsg);\n        }\n    });\n}\n\nasync function resolveTagForProblem(problem: IProblem): Promise<string | undefined> {\n    if (problem.tags.length === 1) {\n        return problem.tags[0];\n    }\n    return await vscode.window.showQuickPick(problem.tags, {\n        matchOnDetail: true,\n        placeHolder: \"Multiple tags available, please select one\",\n        ignoreFocusOut: true,\n    });\n}\n\nasync function resolveCompanyForProblem(problem: IProblem): Promise<string | undefined> {\n    if (problem.companies.length === 1) {\n        return problem.companies[0];\n    }\n    return await vscode.window.showQuickPick(problem.companies, {\n        matchOnDetail: true,\n        placeHolder: \"Multiple tags available, please select one\",\n        ignoreFocusOut: true,\n    });\n}\n"
  },
  {
    "path": "src/commands/star.ts",
    "content": "\n// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { customCodeLensProvider } from \"../codelens/CustomCodeLensProvider\";\nimport { LeetCodeNode } from \"../explorer/LeetCodeNode\";\nimport { leetCodeTreeDataProvider } from \"../explorer/LeetCodeTreeDataProvider\";\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { hasStarShortcut } from \"../utils/settingUtils\";\nimport { DialogType, promptForOpenOutputChannel } from \"../utils/uiUtils\";\n\nexport async function addFavorite(node: LeetCodeNode): Promise<void> {\n    try {\n        await leetCodeExecutor.toggleFavorite(node, true);\n        await leetCodeTreeDataProvider.refresh();\n        if (hasStarShortcut()) {\n            customCodeLensProvider.refresh();\n        }\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to add the problem to favorite. Please open the output channel for details.\", DialogType.error);\n    }\n}\n\nexport async function removeFavorite(node: LeetCodeNode): Promise<void> {\n    try {\n        await leetCodeExecutor.toggleFavorite(node, false);\n        await leetCodeTreeDataProvider.refresh();\n        if (hasStarShortcut()) {\n            customCodeLensProvider.refresh();\n        }\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to remove the problem from favorite. Please open the output channel for details.\", DialogType.error);\n    }\n}\n"
  },
  {
    "path": "src/commands/submit.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { leetCodeTreeDataProvider } from \"../explorer/LeetCodeTreeDataProvider\";\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { leetCodeManager } from \"../leetCodeManager\";\nimport { DialogType, promptForOpenOutputChannel, promptForSignIn } from \"../utils/uiUtils\";\nimport { getActiveFilePath } from \"../utils/workspaceUtils\";\nimport { leetCodeSubmissionProvider } from \"../webview/leetCodeSubmissionProvider\";\n\nexport async function submitSolution(uri?: vscode.Uri): Promise<void> {\n    if (!leetCodeManager.getUser()) {\n        promptForSignIn();\n        return;\n    }\n\n    const filePath: string | undefined = await getActiveFilePath(uri);\n    if (!filePath) {\n        return;\n    }\n\n    try {\n        const result: string = await leetCodeExecutor.submitSolution(filePath);\n        leetCodeSubmissionProvider.show(result);\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to submit the solution. Please open the output channel for details.\", DialogType.error);\n        return;\n    }\n\n    leetCodeTreeDataProvider.refresh();\n}\n"
  },
  {
    "path": "src/commands/test.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as fse from \"fs-extra\";\nimport * as vscode from \"vscode\";\nimport { leetCodeExecutor } from \"../leetCodeExecutor\";\nimport { leetCodeManager } from \"../leetCodeManager\";\nimport { IQuickItemEx, UserStatus } from \"../shared\";\nimport { isWindows, usingCmd } from \"../utils/osUtils\";\nimport { DialogType, promptForOpenOutputChannel, showFileSelectDialog } from \"../utils/uiUtils\";\nimport { getActiveFilePath } from \"../utils/workspaceUtils\";\nimport * as wsl from \"../utils/wslUtils\";\nimport { leetCodeSubmissionProvider } from \"../webview/leetCodeSubmissionProvider\";\n\nexport async function testSolution(uri?: vscode.Uri): Promise<void> {\n    try {\n        if (leetCodeManager.getStatus() === UserStatus.SignedOut) {\n            return;\n        }\n\n        const filePath: string | undefined = await getActiveFilePath(uri);\n        if (!filePath) {\n            return;\n        }\n        const picks: Array<IQuickItemEx<string>> = [];\n        picks.push(\n            {\n                label: \"$(three-bars) Default test cases\",\n                description: \"\",\n                detail: \"Test with the default cases\",\n                value: \":default\",\n            },\n            {\n                label: \"$(pencil) Write directly...\",\n                description: \"\",\n                detail: \"Write test cases in input box\",\n                value: \":direct\",\n            },\n            {\n                label: \"$(file-text) Browse...\",\n                description: \"\",\n                detail: \"Test with the written cases in file\",\n                value: \":file\",\n            },\n        );\n        const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick(picks);\n        if (!choice) {\n            return;\n        }\n\n        let result: string | undefined;\n        switch (choice.value) {\n            case \":default\":\n                result = await leetCodeExecutor.testSolution(filePath);\n                break;\n            case \":direct\":\n                const testString: string | undefined = await vscode.window.showInputBox({\n                    prompt: \"Enter the test cases.\",\n                    validateInput: (s: string): string | undefined => s && s.trim() ? undefined : \"Test case must not be empty.\",\n                    placeHolder: \"Example: [1,2,3]\\\\n4\",\n                    ignoreFocusOut: true,\n                });\n                if (testString) {\n                    result = await leetCodeExecutor.testSolution(filePath, parseTestString(testString));\n                }\n                break;\n            case \":file\":\n                const testFile: vscode.Uri[] | undefined = await showFileSelectDialog(filePath);\n                if (testFile && testFile.length) {\n                    const input: string = (await fse.readFile(testFile[0].fsPath, \"utf-8\")).trim();\n                    if (input) {\n                        result = await leetCodeExecutor.testSolution(filePath, parseTestString(input.replace(/\\r?\\n/g, \"\\\\n\")));\n                    } else {\n                        vscode.window.showErrorMessage(\"The selected test file must not be empty.\");\n                    }\n                }\n                break;\n            default:\n                break;\n        }\n        if (!result) {\n            return;\n        }\n        leetCodeSubmissionProvider.show(result);\n    } catch (error) {\n        await promptForOpenOutputChannel(\"Failed to test the solution. Please open the output channel for details.\", DialogType.error);\n    }\n}\n\nfunction parseTestString(test: string): string {\n    if (wsl.useWsl() || !isWindows()) {\n        return `'${test}'`;\n    }\n\n    // In windows and not using WSL\n    if (usingCmd()) {\n        return `\"${test.replace(/\"/g, '\\\\\"')}\"`;\n    } else {\n        // Assume using PowerShell\n        return `'${test.replace(/\"/g, '\\\\\"')}'`;\n    }\n}\n"
  },
  {
    "path": "src/explorer/LeetCodeNode.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { Command, Uri } from \"vscode\";\nimport { IProblem, ProblemState } from \"../shared\";\n\nexport class LeetCodeNode {\n\n    constructor(private data: IProblem, private isProblemNode: boolean = true) { }\n\n    public get locked(): boolean {\n        return this.data.locked;\n    }\n    public get name(): string {\n        return this.data.name;\n    }\n\n    public get state(): ProblemState {\n        return this.data.state;\n    }\n\n    public get id(): string {\n        return this.data.id;\n    }\n\n    public get passRate(): string {\n        return this.data.passRate;\n    }\n\n    public get difficulty(): string {\n        return this.data.difficulty;\n    }\n\n    public get tags(): string[] {\n        return this.data.tags;\n    }\n\n    public get companies(): string[] {\n        return this.data.companies;\n    }\n\n    public get isFavorite(): boolean {\n        return this.data.isFavorite;\n    }\n\n    public get isProblem(): boolean {\n        return this.isProblemNode;\n    }\n\n    public get previewCommand(): Command {\n        return {\n            title: \"Preview Problem\",\n            command: \"leetcode.previewProblem\",\n            arguments: [this],\n        };\n    }\n\n    public get acceptanceRate(): number {\n        return Number(this.passRate.slice(0, -1).trim());\n    }\n\n    public get uri(): Uri {\n        return Uri.from({\n            scheme: \"leetcode\",\n            authority: this.isProblem ? \"problems\" : \"tree-node\",\n            path: `/${this.id}`, // path must begin with slash /\n            query: `difficulty=${this.difficulty}`,\n        });\n    }\n\n}\n"
  },
  {
    "path": "src/explorer/LeetCodeTreeDataProvider.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as os from \"os\";\nimport * as path from \"path\";\nimport * as vscode from \"vscode\";\nimport { leetCodeManager } from \"../leetCodeManager\";\nimport { Category, defaultProblem, ProblemState } from \"../shared\";\nimport { explorerNodeManager } from \"./explorerNodeManager\";\nimport { LeetCodeNode } from \"./LeetCodeNode\";\nimport { globalState } from \"../globalState\";\n\nexport class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCodeNode> {\n    private context: vscode.ExtensionContext;\n\n    private onDidChangeTreeDataEvent: vscode.EventEmitter<LeetCodeNode | undefined | null> = new vscode.EventEmitter<\n        LeetCodeNode | undefined | null\n    >();\n    // tslint:disable-next-line:member-ordering\n    public readonly onDidChangeTreeData: vscode.Event<any> = this.onDidChangeTreeDataEvent.event;\n\n    public initialize(context: vscode.ExtensionContext): void {\n        this.context = context;\n    }\n\n    public async refresh(): Promise<void> {\n        await explorerNodeManager.refreshCache();\n        this.onDidChangeTreeDataEvent.fire(null);\n    }\n\n    public getTreeItem(element: LeetCodeNode): vscode.TreeItem | Thenable<vscode.TreeItem> {\n        if (element.id === \"notSignIn\") {\n            return {\n                label: element.name,\n                collapsibleState: vscode.TreeItemCollapsibleState.None,\n                command: {\n                    command: \"leetcode.signin\",\n                    title: \"Sign in to LeetCode\",\n                },\n            };\n        }\n\n        let contextValue: string;\n        if (element.isProblem) {\n            contextValue = element.isFavorite ? \"problem-favorite\" : \"problem\";\n        } else {\n            contextValue = element.id.toLowerCase();\n        }\n\n        return {\n            label: element.isProblem ? `[${element.id}] ${element.name}` + this.parsePremiumUnLockIconPath(element) : element.name,\n            tooltip: this.getSubCategoryTooltip(element),\n            collapsibleState: element.isProblem ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,\n            iconPath: this.parseIconPathFromProblemState(element),\n            command: element.isProblem ? element.previewCommand : undefined,\n            resourceUri: element.uri,\n            contextValue,\n        };\n    }\n\n    public getChildren(element?: LeetCodeNode | undefined): vscode.ProviderResult<LeetCodeNode[]> {\n        if (!leetCodeManager.getUser()) {\n            return [\n                new LeetCodeNode(\n                    Object.assign({}, defaultProblem, {\n                        id: \"notSignIn\",\n                        name: \"Sign in to LeetCode\",\n                    }),\n                    false\n                ),\n            ];\n        }\n        if (!element) {\n            // Root view\n            return explorerNodeManager.getRootNodes();\n        } else {\n            switch (element.id) {\n                case Category.All:\n                    return explorerNodeManager.getAllNodes();\n                case Category.Favorite:\n                    return explorerNodeManager.getFavoriteNodes();\n                case Category.Difficulty:\n                    return explorerNodeManager.getAllDifficultyNodes();\n                case Category.Tag:\n                    return explorerNodeManager.getAllTagNodes();\n                case Category.Company:\n                    return explorerNodeManager.getAllCompanyNodes();\n                default:\n                    if (element.isProblem) {\n                        return [];\n                    }\n                    return explorerNodeManager.getChildrenNodesById(element.id);\n            }\n        }\n    }\n\n    private parseIconPathFromProblemState(element: LeetCodeNode): string {\n        if (!element.isProblem) {\n            return \"\";\n        }\n        const { isPremium } = globalState.getUserStatus() ?? {};\n        switch (element.state) {\n            case ProblemState.AC:\n                return this.context.asAbsolutePath(path.join(\"resources\", \"check.png\"));\n            case ProblemState.NotAC:\n                return this.context.asAbsolutePath(path.join(\"resources\", \"x.png\"));\n            case ProblemState.Unknown:\n                if (element.locked && !isPremium) {\n                    return this.context.asAbsolutePath(path.join(\"resources\", \"lock.png\"));\n                }\n                return this.context.asAbsolutePath(path.join(\"resources\", \"blank.png\"));\n            default:\n                return \"\";\n        }\n    }\n\n    private parsePremiumUnLockIconPath(element: LeetCodeNode): string {\n        const { isPremium } = globalState.getUserStatus() ?? {};\n        if (isPremium && element.locked) {\n            return \"  🔓\";\n        }\n        return \"\";\n    }\n\n    private getSubCategoryTooltip(element: LeetCodeNode): string {\n        // return '' unless it is a sub-category node\n        if (element.isProblem || element.id === \"ROOT\" || element.id in Category) {\n            return \"\";\n        }\n\n        const childernNodes: LeetCodeNode[] = explorerNodeManager.getChildrenNodesById(element.id);\n\n        let acceptedNum: number = 0;\n        let failedNum: number = 0;\n        for (const node of childernNodes) {\n            switch (node.state) {\n                case ProblemState.AC:\n                    acceptedNum++;\n                    break;\n                case ProblemState.NotAC:\n                    failedNum++;\n                    break;\n                default:\n                    break;\n            }\n        }\n\n        return [`AC: ${acceptedNum}`, `Failed: ${failedNum}`, `Total: ${childernNodes.length}`].join(os.EOL);\n    }\n}\n\nexport const leetCodeTreeDataProvider: LeetCodeTreeDataProvider = new LeetCodeTreeDataProvider();\n"
  },
  {
    "path": "src/explorer/LeetCodeTreeItemDecorationProvider.ts",
    "content": "import { URLSearchParams } from \"url\";\nimport { FileDecoration, FileDecorationProvider, ProviderResult, ThemeColor, Uri, workspace, WorkspaceConfiguration } from \"vscode\";\n\nexport class LeetCodeTreeItemDecorationProvider implements FileDecorationProvider {\n    private readonly DIFFICULTY_BADGE_LABEL: { [key: string]: string } = {\n        easy: \"E\",\n        medium: \"M\",\n        hard: \"H\",\n    };\n\n    private readonly ITEM_COLOR: { [key: string]: ThemeColor } = {\n        easy: new ThemeColor(\"charts.green\"),\n        medium: new ThemeColor(\"charts.yellow\"),\n        hard: new ThemeColor(\"charts.red\"),\n    };\n\n    public provideFileDecoration(uri: Uri): ProviderResult<FileDecoration>  {\n        if (!this.isDifficultyBadgeEnabled()) {\n            return;\n        }\n\n        if (uri.scheme !== \"leetcode\" && uri.authority !== \"problems\") {\n            return;\n        }\n\n        const params: URLSearchParams = new URLSearchParams(uri.query);\n        const difficulty: string = params.get(\"difficulty\")!.toLowerCase();\n        return {\n            badge: this.DIFFICULTY_BADGE_LABEL[difficulty],\n            color: this.ITEM_COLOR[difficulty],\n        };\n    }\n\n    private isDifficultyBadgeEnabled(): boolean {\n        const configuration: WorkspaceConfiguration = workspace.getConfiguration();\n        return configuration.get<boolean>(\"leetcode.colorizeProblems\", false);\n    }\n}\n\nexport const leetCodeTreeItemDecorationProvider: LeetCodeTreeItemDecorationProvider = new LeetCodeTreeItemDecorationProvider();\n"
  },
  {
    "path": "src/explorer/explorerNodeManager.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as _ from \"lodash\";\nimport { Disposable } from \"vscode\";\nimport * as list from \"../commands/list\";\nimport { getSortingStrategy } from \"../commands/plugin\";\nimport { Category, defaultProblem, ProblemState, SortingStrategy } from \"../shared\";\nimport { shouldHideSolvedProblem } from \"../utils/settingUtils\";\nimport { LeetCodeNode } from \"./LeetCodeNode\";\n\nclass ExplorerNodeManager implements Disposable {\n    private explorerNodeMap: Map<string, LeetCodeNode> = new Map<string, LeetCodeNode>();\n    private companySet: Set<string> = new Set<string>();\n    private tagSet: Set<string> = new Set<string>();\n\n    public async refreshCache(): Promise<void> {\n        this.dispose();\n        const shouldHideSolved: boolean = shouldHideSolvedProblem();\n        for (const problem of await list.listProblems()) {\n            if (shouldHideSolved && problem.state === ProblemState.AC) {\n                continue;\n            }\n            this.explorerNodeMap.set(problem.id, new LeetCodeNode(problem));\n            for (const company of problem.companies) {\n                this.companySet.add(company);\n            }\n            for (const tag of problem.tags) {\n                this.tagSet.add(tag);\n            }\n        }\n    }\n\n    public getRootNodes(): LeetCodeNode[] {\n        return [\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: Category.All,\n                name: Category.All,\n            }), false),\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: Category.Difficulty,\n                name: Category.Difficulty,\n            }), false),\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: Category.Tag,\n                name: Category.Tag,\n            }), false),\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: Category.Company,\n                name: Category.Company,\n            }), false),\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: Category.Favorite,\n                name: Category.Favorite,\n            }), false),\n        ];\n    }\n\n    public getAllNodes(): LeetCodeNode[] {\n        return this.applySortingStrategy(\n            Array.from(this.explorerNodeMap.values()),\n        );\n    }\n\n    public getAllDifficultyNodes(): LeetCodeNode[] {\n        const res: LeetCodeNode[] = [];\n        res.push(\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: `${Category.Difficulty}.Easy`,\n                name: \"Easy\",\n            }), false),\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: `${Category.Difficulty}.Medium`,\n                name: \"Medium\",\n            }), false),\n            new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: `${Category.Difficulty}.Hard`,\n                name: \"Hard\",\n            }), false),\n        );\n        this.sortSubCategoryNodes(res, Category.Difficulty);\n        return res;\n    }\n\n    public getAllCompanyNodes(): LeetCodeNode[] {\n        const res: LeetCodeNode[] = [];\n        for (const company of this.companySet.values()) {\n            res.push(new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: `${Category.Company}.${company}`,\n                name: _.startCase(company),\n            }), false));\n        }\n        this.sortSubCategoryNodes(res, Category.Company);\n        return res;\n    }\n\n    public getAllTagNodes(): LeetCodeNode[] {\n        const res: LeetCodeNode[] = [];\n        for (const tag of this.tagSet.values()) {\n            res.push(new LeetCodeNode(Object.assign({}, defaultProblem, {\n                id: `${Category.Tag}.${tag}`,\n                name: _.startCase(tag),\n            }), false));\n        }\n        this.sortSubCategoryNodes(res, Category.Tag);\n        return res;\n    }\n\n    public getNodeById(id: string): LeetCodeNode | undefined {\n        return this.explorerNodeMap.get(id);\n    }\n\n    public getFavoriteNodes(): LeetCodeNode[] {\n        const res: LeetCodeNode[] = [];\n        for (const node of this.explorerNodeMap.values()) {\n            if (node.isFavorite) {\n                res.push(node);\n            }\n        }\n        return this.applySortingStrategy(res);\n    }\n\n    public getChildrenNodesById(id: string): LeetCodeNode[] {\n        // The sub-category node's id is named as {Category.SubName}\n        const metaInfo: string[] = id.split(\".\");\n        const res: LeetCodeNode[] = [];\n        for (const node of this.explorerNodeMap.values()) {\n            switch (metaInfo[0]) {\n                case Category.Company:\n                    if (node.companies.indexOf(metaInfo[1]) >= 0) {\n                        res.push(node);\n                    }\n                    break;\n                case Category.Difficulty:\n                    if (node.difficulty === metaInfo[1]) {\n                        res.push(node);\n                    }\n                    break;\n                case Category.Tag:\n                    if (node.tags.indexOf(metaInfo[1]) >= 0) {\n                        res.push(node);\n                    }\n                    break;\n                default:\n                    break;\n            }\n        }\n        return this.applySortingStrategy(res);\n    }\n\n    public dispose(): void {\n        this.explorerNodeMap.clear();\n        this.companySet.clear();\n        this.tagSet.clear();\n    }\n\n    private sortSubCategoryNodes(subCategoryNodes: LeetCodeNode[], category: Category): void {\n        switch (category) {\n            case Category.Difficulty:\n                subCategoryNodes.sort((a: LeetCodeNode, b: LeetCodeNode): number => {\n                    function getValue(input: LeetCodeNode): number {\n                        switch (input.name.toLowerCase()) {\n                            case \"easy\":\n                                return 1;\n                            case \"medium\":\n                                return 2;\n                            case \"hard\":\n                                return 3;\n                            default:\n                                return Number.MAX_SAFE_INTEGER;\n                        }\n                    }\n                    return getValue(a) - getValue(b);\n                });\n                break;\n            case Category.Tag:\n            case Category.Company:\n                subCategoryNodes.sort((a: LeetCodeNode, b: LeetCodeNode): number => {\n                    if (a.name === \"Unknown\") {\n                        return 1;\n                    } else if (b.name === \"Unknown\") {\n                        return -1;\n                    } else {\n                        return Number(a.name > b.name) - Number(a.name < b.name);\n                    }\n                });\n                break;\n            default:\n                break;\n        }\n    }\n\n    private applySortingStrategy(nodes: LeetCodeNode[]): LeetCodeNode[] {\n        const strategy: SortingStrategy = getSortingStrategy();\n        switch (strategy) {\n            case SortingStrategy.AcceptanceRateAsc: return nodes.sort((x: LeetCodeNode, y: LeetCodeNode) => Number(x.acceptanceRate) - Number(y.acceptanceRate));\n            case SortingStrategy.AcceptanceRateDesc: return nodes.sort((x: LeetCodeNode, y: LeetCodeNode) => Number(y.acceptanceRate) - Number(x.acceptanceRate));\n            default: return nodes;\n        }\n    }\n}\n\nexport const explorerNodeManager: ExplorerNodeManager = new ExplorerNodeManager();\n"
  },
  {
    "path": "src/extension.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { codeLensController } from \"./codelens/CodeLensController\";\nimport * as cache from \"./commands/cache\";\nimport { switchDefaultLanguage } from \"./commands/language\";\nimport * as plugin from \"./commands/plugin\";\nimport * as session from \"./commands/session\";\nimport * as show from \"./commands/show\";\nimport * as star from \"./commands/star\";\nimport * as submit from \"./commands/submit\";\nimport * as test from \"./commands/test\";\nimport { explorerNodeManager } from \"./explorer/explorerNodeManager\";\nimport { LeetCodeNode } from \"./explorer/LeetCodeNode\";\nimport { leetCodeTreeDataProvider } from \"./explorer/LeetCodeTreeDataProvider\";\nimport { leetCodeTreeItemDecorationProvider } from \"./explorer/LeetCodeTreeItemDecorationProvider\";\nimport { leetCodeChannel } from \"./leetCodeChannel\";\nimport { leetCodeExecutor } from \"./leetCodeExecutor\";\nimport { leetCodeManager } from \"./leetCodeManager\";\nimport { leetCodeStatusBarController } from \"./statusbar/leetCodeStatusBarController\";\nimport { DialogType, promptForOpenOutputChannel } from \"./utils/uiUtils\";\nimport { leetCodePreviewProvider } from \"./webview/leetCodePreviewProvider\";\nimport { leetCodeSolutionProvider } from \"./webview/leetCodeSolutionProvider\";\nimport { leetCodeSubmissionProvider } from \"./webview/leetCodeSubmissionProvider\";\nimport { markdownEngine } from \"./webview/markdownEngine\";\nimport TrackData from \"./utils/trackingUtils\";\nimport { globalState } from \"./globalState\";\n\nexport async function activate(context: vscode.ExtensionContext): Promise<void> {\n    try {\n        if (!(await leetCodeExecutor.meetRequirements(context))) {\n            throw new Error(\"The environment doesn't meet requirements.\");\n        }\n\n        leetCodeManager.on(\"statusChanged\", () => {\n            leetCodeStatusBarController.updateStatusBar(leetCodeManager.getStatus(), leetCodeManager.getUser());\n            leetCodeTreeDataProvider.refresh();\n        });\n\n        leetCodeTreeDataProvider.initialize(context);\n        globalState.initialize(context);\n\n        context.subscriptions.push(\n            leetCodeStatusBarController,\n            leetCodeChannel,\n            leetCodePreviewProvider,\n            leetCodeSubmissionProvider,\n            leetCodeSolutionProvider,\n            leetCodeExecutor,\n            markdownEngine,\n            codeLensController,\n            explorerNodeManager,\n            vscode.window.registerFileDecorationProvider(leetCodeTreeItemDecorationProvider),\n            vscode.window.createTreeView(\"leetCodeExplorer\", { treeDataProvider: leetCodeTreeDataProvider, showCollapseAll: true }),\n            vscode.commands.registerCommand(\"leetcode.deleteCache\", () => cache.deleteCache()),\n            vscode.commands.registerCommand(\"leetcode.toggleLeetCodeCn\", () => plugin.switchEndpoint()),\n            vscode.commands.registerCommand(\"leetcode.signin\", () => leetCodeManager.signIn()),\n            vscode.commands.registerCommand(\"leetcode.signout\", () => leetCodeManager.signOut()),\n            vscode.commands.registerCommand(\"leetcode.manageSessions\", () => session.manageSessions()),\n            vscode.commands.registerCommand(\"leetcode.previewProblem\", (node: LeetCodeNode) => {\n                TrackData.report({\n                    event_key: `vscode_open_problem`,\n                    type: \"click\",\n                    extra: JSON.stringify({\n                        problem_id: node.id,\n                        problem_name: node.name,\n                    }),\n                });\n                show.previewProblem(node);\n            }),\n            vscode.commands.registerCommand(\"leetcode.showProblem\", (node: LeetCodeNode) => show.showProblem(node)),\n            vscode.commands.registerCommand(\"leetcode.pickOne\", () => show.pickOne()),\n            vscode.commands.registerCommand(\"leetcode.searchProblem\", () => show.searchProblem()),\n            vscode.commands.registerCommand(\"leetcode.showSolution\", (input: LeetCodeNode | vscode.Uri) => show.showSolution(input)),\n            vscode.commands.registerCommand(\"leetcode.refreshExplorer\", () => leetCodeTreeDataProvider.refresh()),\n            vscode.commands.registerCommand(\"leetcode.testSolution\", (uri?: vscode.Uri) => {\n                TrackData.report({\n                    event_key: `vscode_runCode`,\n                    type: \"click\",\n                    extra: JSON.stringify({\n                        path: uri?.path,\n                    }),\n                });\n                return test.testSolution(uri);\n            }),\n            vscode.commands.registerCommand(\"leetcode.submitSolution\", (uri?: vscode.Uri) => {\n                TrackData.report({\n                    event_key: `vscode_submit`,\n                    type: \"click\",\n                    extra: JSON.stringify({\n                        path: uri?.path,\n                    }),\n                });\n                return submit.submitSolution(uri);\n            }),\n            vscode.commands.registerCommand(\"leetcode.switchDefaultLanguage\", () => switchDefaultLanguage()),\n            vscode.commands.registerCommand(\"leetcode.addFavorite\", (node: LeetCodeNode) => star.addFavorite(node)),\n            vscode.commands.registerCommand(\"leetcode.removeFavorite\", (node: LeetCodeNode) => star.removeFavorite(node)),\n            vscode.commands.registerCommand(\"leetcode.problems.sort\", () => plugin.switchSortingStrategy())\n        );\n\n        await leetCodeExecutor.switchEndpoint(plugin.getLeetCodeEndpoint());\n        await leetCodeManager.getLoginStatus();\n        vscode.window.registerUriHandler({ handleUri: leetCodeManager.handleUriSignIn });\n    } catch (error) {\n        leetCodeChannel.appendLine(error.toString());\n        promptForOpenOutputChannel(\"Extension initialization failed. Please open output channel for details.\", DialogType.error);\n    }\n}\n\nexport function deactivate(): void {\n    // Do nothing.\n}\n"
  },
  {
    "path": "src/globalState.ts",
    "content": "// Copyright (c) leo.zhao. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\n\nconst CookieKey = \"leetcode-cookie\";\nconst UserStatusKey = \"leetcode-user-status\";\n\nexport type UserDataType = {\n    isSignedIn: boolean;\n    isPremium: boolean;\n    username: string;\n    avatar: string;\n    isVerified?: boolean;\n};\n\nclass GlobalState {\n    private context: vscode.ExtensionContext;\n    private _state: vscode.Memento;\n    private _cookie: string;\n    private _userStatus: UserDataType;\n\n    public initialize(context: vscode.ExtensionContext): void {\n        this.context = context;\n        this._state = this.context.globalState;\n    }\n\n    public setCookie(cookie: string): any {\n        this._cookie = cookie;\n        return this._state.update(CookieKey, this._cookie);\n    }\n    public getCookie(): string | undefined {\n        return this._cookie ?? this._state.get(CookieKey);\n    }\n\n    public setUserStatus(userStatus: UserDataType): any {\n        this._userStatus = userStatus;\n        return this._state.update(UserStatusKey, this._userStatus);\n    }\n\n    public getUserStatus(): UserDataType | undefined {\n        return this._userStatus ?? this._state.get(UserStatusKey);\n    }\n\n    public removeCookie(): void {\n        this._state.update(CookieKey, undefined);\n    }\n\n    public removeAll(): void {\n        this._state.update(CookieKey, undefined);\n        this._state.update(UserStatusKey, undefined);\n    }\n}\n\nexport const globalState: GlobalState = new GlobalState();\n"
  },
  {
    "path": "src/leetCodeChannel.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\n\nclass LeetCodeChannel implements vscode.Disposable {\n    private readonly channel: vscode.OutputChannel = vscode.window.createOutputChannel(\"LeetCode\");\n\n    public appendLine(message: string): void {\n        this.channel.appendLine(message);\n    }\n\n    public append(message: string): void {\n        this.channel.append(message);\n    }\n\n    public show(): void {\n        this.channel.show();\n    }\n\n    public dispose(): void {\n        this.channel.dispose();\n    }\n}\n\nexport const leetCodeChannel: LeetCodeChannel = new LeetCodeChannel();\n"
  },
  {
    "path": "src/leetCodeExecutor.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as cp from \"child_process\";\nimport * as fse from \"fs-extra\";\nimport * as os from \"os\";\nimport * as path from \"path\";\nimport * as requireFromString from \"require-from-string\";\nimport { ExtensionContext } from \"vscode\";\nimport { ConfigurationChangeEvent, Disposable, MessageItem, window, workspace, WorkspaceConfiguration } from \"vscode\";\nimport { Endpoint, IProblem, leetcodeHasInited, supportedPlugins } from \"./shared\";\nimport { executeCommand, executeCommandWithProgress } from \"./utils/cpUtils\";\nimport { DialogOptions, openUrl } from \"./utils/uiUtils\";\nimport * as wsl from \"./utils/wslUtils\";\nimport { toWslPath, useWsl } from \"./utils/wslUtils\";\n\nclass LeetCodeExecutor implements Disposable {\n    private leetCodeRootPath: string;\n    private nodeExecutable: string;\n    private configurationChangeListener: Disposable;\n\n    constructor() {\n        this.leetCodeRootPath = path.join(__dirname, \"..\", \"..\", \"node_modules\", \"vsc-leetcode-cli\");\n        this.nodeExecutable = this.getNodePath();\n        this.configurationChangeListener = workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {\n            if (event.affectsConfiguration(\"leetcode.nodePath\")) {\n                this.nodeExecutable = this.getNodePath();\n            }\n        }, this);\n    }\n\n    public async getLeetCodeBinaryPath(): Promise<string> {\n        if (wsl.useWsl()) {\n            return `${await wsl.toWslPath(`\"${path.join(this.leetCodeRootPath, \"bin\", \"leetcode\")}\"`)}`;\n        }\n        return `\"${path.join(this.leetCodeRootPath, \"bin\", \"leetcode\")}\"`;\n    }\n\n    public async meetRequirements(context: ExtensionContext): Promise<boolean> {\n        const hasInited: boolean | undefined = context.globalState.get(leetcodeHasInited);\n        if (!hasInited) {\n            await this.removeOldCache();\n        }\n        if (this.nodeExecutable !== \"node\") {\n            if (!await fse.pathExists(this.nodeExecutable)) {\n                throw new Error(`The Node.js executable does not exist on path ${this.nodeExecutable}`);\n            }\n            // Wrap the executable with \"\" to avoid space issue in the path.\n            this.nodeExecutable = `\"${this.nodeExecutable}\"`;\n            if (useWsl()) {\n                this.nodeExecutable = await toWslPath(this.nodeExecutable);\n            }\n        }\n        try {\n            await this.executeCommandEx(this.nodeExecutable, [\"-v\"]);\n        } catch (error) {\n            const choice: MessageItem | undefined = await window.showErrorMessage(\n                \"LeetCode extension needs Node.js installed in environment path\",\n                DialogOptions.open,\n            );\n            if (choice === DialogOptions.open) {\n                openUrl(\"https://nodejs.org\");\n            }\n            return false;\n        }\n        for (const plugin of supportedPlugins) {\n            try { // Check plugin\n                await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"plugin\", \"-e\", plugin]);\n            } catch (error) { // Remove old cache that may cause the error download plugin and activate\n                await this.removeOldCache();\n                await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"plugin\", \"-i\", plugin]);\n            }\n        }\n        // Set the global state HasInited true to skip delete old cache after init\n        context.globalState.update(leetcodeHasInited, true);\n        return true;\n    }\n\n    public async deleteCache(): Promise<string> {\n        return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"cache\", \"-d\"]);\n    }\n\n    public async getUserInfo(): Promise<string> {\n        return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"user\"]);\n    }\n\n    public async signOut(): Promise<string> {\n        return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"user\", \"-L\"]);\n    }\n\n    public async listProblems(showLocked: boolean, needTranslation: boolean): Promise<string> {\n        const cmd: string[] = [await this.getLeetCodeBinaryPath(), \"list\"];\n        if (!needTranslation) {\n            cmd.push(\"-T\"); // use -T to prevent translation\n        }\n        if (!showLocked) {\n            cmd.push(\"-q\");\n            cmd.push(\"L\");\n        }\n        return await this.executeCommandEx(this.nodeExecutable, cmd);\n    }\n\n    public async showProblem(problemNode: IProblem, language: string, filePath: string, showDescriptionInComment: boolean = false, needTranslation: boolean): Promise<void> {\n        const templateType: string = showDescriptionInComment ? \"-cx\" : \"-c\";\n        const cmd: string[] = [await this.getLeetCodeBinaryPath(), \"show\", problemNode.id, templateType, \"-l\", language];\n\n        if (!needTranslation) {\n            cmd.push(\"-T\"); // use -T to force English version\n        }\n\n        if (!await fse.pathExists(filePath)) {\n            await fse.createFile(filePath);\n            const codeTemplate: string = await this.executeCommandWithProgressEx(\"Fetching problem data...\", this.nodeExecutable, cmd);\n            await fse.writeFile(filePath, codeTemplate);\n        }\n    }\n\n    /**\n     * This function returns solution of a problem identified by input\n     *\n     * @remarks\n     * Even though this function takes the needTranslation flag, it is important to note\n     * that as of vsc-leetcode-cli 2.8.0, leetcode-cli doesn't support querying solution\n     * on CN endpoint yet. So this flag doesn't have any effect right now.\n     *\n     * @param input - parameter to pass to cli that can identify a problem\n     * @param language - the source code language of the solution desired\n     * @param needTranslation - whether or not to use endPoint translation on solution query\n     * @returns promise of the solution string\n     */\n    public async showSolution(input: string, language: string, needTranslation: boolean): Promise<string> {\n        // solution don't support translation\n        const cmd: string[] = [await this.getLeetCodeBinaryPath(), \"show\", input, \"--solution\", \"-l\", language];\n        if (!needTranslation) {\n            cmd.push(\"-T\");\n        }\n        const solution: string = await this.executeCommandWithProgressEx(\"Fetching top voted solution from discussions...\", this.nodeExecutable, cmd);\n        return solution;\n    }\n\n    public async getDescription(problemNodeId: string, needTranslation: boolean): Promise<string> {\n        const cmd: string[] = [await this.getLeetCodeBinaryPath(), \"show\", problemNodeId, \"-x\"];\n        if (!needTranslation) {\n            cmd.push(\"-T\");\n        }\n        return await this.executeCommandWithProgressEx(\"Fetching problem description...\", this.nodeExecutable, cmd);\n    }\n\n    public async listSessions(): Promise<string> {\n        return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"session\"]);\n    }\n\n    public async enableSession(name: string): Promise<string> {\n        return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"session\", \"-e\", name]);\n    }\n\n    public async createSession(id: string): Promise<string> {\n        return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"session\", \"-c\", id]);\n    }\n\n    public async deleteSession(id: string): Promise<string> {\n        return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"session\", \"-d\", id]);\n    }\n\n    public async submitSolution(filePath: string): Promise<string> {\n        try {\n            return await this.executeCommandWithProgressEx(\"Submitting to LeetCode...\", this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"submit\", `\"${filePath}\"`]);\n        } catch (error) {\n            if (error.result) {\n                return error.result;\n            }\n            throw error;\n        }\n    }\n\n    public async testSolution(filePath: string, testString?: string): Promise<string> {\n        if (testString) {\n            return await this.executeCommandWithProgressEx(\"Submitting to LeetCode...\", this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"test\", `\"${filePath}\"`, \"-t\", `${testString}`]);\n        }\n        return await this.executeCommandWithProgressEx(\"Submitting to LeetCode...\", this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"test\", `\"${filePath}\"`]);\n    }\n\n    public async switchEndpoint(endpoint: string): Promise<string> {\n        switch (endpoint) {\n            case Endpoint.LeetCodeCN:\n                return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"plugin\", \"-e\", \"leetcode.cn\"]);\n            case Endpoint.LeetCode:\n            default:\n                return await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), \"plugin\", \"-d\", \"leetcode.cn\"]);\n        }\n    }\n\n    public async toggleFavorite(node: IProblem, addToFavorite: boolean): Promise<void> {\n        const commandParams: string[] = [await this.getLeetCodeBinaryPath(), \"star\", node.id];\n        if (!addToFavorite) {\n            commandParams.push(\"-d\");\n        }\n        await this.executeCommandWithProgressEx(\"Updating the favorite list...\", \"node\", commandParams);\n    }\n\n    public async getCompaniesAndTags(): Promise<{ companies: { [key: string]: string[] }, tags: { [key: string]: string[] } }> {\n        // preprocess the plugin source\n        const companiesTagsPath: string = path.join(this.leetCodeRootPath, \"lib\", \"plugins\", \"company.js\");\n        const companiesTagsSrc: string = (await fse.readFile(companiesTagsPath, \"utf8\")).replace(\n            \"module.exports = plugin\",\n            \"module.exports = { COMPONIES, TAGS }\",\n        );\n        const { COMPONIES, TAGS } = requireFromString(companiesTagsSrc, companiesTagsPath);\n        return { companies: COMPONIES, tags: TAGS };\n    }\n\n    public get node(): string {\n        return this.nodeExecutable;\n    }\n\n    public dispose(): void {\n        this.configurationChangeListener.dispose();\n    }\n\n    private getNodePath(): string {\n        const extensionConfig: WorkspaceConfiguration = workspace.getConfiguration(\"leetcode\", null);\n        return extensionConfig.get<string>(\"nodePath\", \"node\" /* default value */);\n    }\n\n    private async executeCommandEx(command: string, args: string[], options: cp.SpawnOptions = { shell: true }): Promise<string> {\n        if (wsl.useWsl()) {\n            return await executeCommand(\"wsl\", [command].concat(args), options);\n        }\n        return await executeCommand(command, args, options);\n    }\n\n    private async executeCommandWithProgressEx(message: string, command: string, args: string[], options: cp.SpawnOptions = { shell: true }): Promise<string> {\n        if (wsl.useWsl()) {\n            return await executeCommandWithProgress(message, \"wsl\", [command].concat(args), options);\n        }\n        return await executeCommandWithProgress(message, command, args, options);\n    }\n\n    private async removeOldCache(): Promise<void> {\n        const oldPath: string = path.join(os.homedir(), \".lc\");\n        if (await fse.pathExists(oldPath)) {\n            await fse.remove(oldPath);\n        }\n    }\n\n}\n\nexport const leetCodeExecutor: LeetCodeExecutor = new LeetCodeExecutor();\n"
  },
  {
    "path": "src/leetCodeManager.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as cp from \"child_process\";\nimport { EventEmitter } from \"events\";\nimport * as vscode from \"vscode\";\nimport { leetCodeChannel } from \"./leetCodeChannel\";\nimport { leetCodeExecutor } from \"./leetCodeExecutor\";\nimport { Endpoint, IQuickItemEx, loginArgsMapping, urls, urlsCn, UserStatus } from \"./shared\";\nimport { createEnvOption } from \"./utils/cpUtils\";\nimport { DialogType, openUrl, promptForOpenOutputChannel } from \"./utils/uiUtils\";\nimport * as wsl from \"./utils/wslUtils\";\nimport { getLeetCodeEndpoint } from \"./commands/plugin\";\nimport { globalState } from \"./globalState\";\nimport { queryUserData } from \"./request/query-user-data\";\nimport { parseQuery } from \"./utils/toolUtils\";\n\nclass LeetCodeManager extends EventEmitter {\n    private currentUser: string | undefined;\n    private userStatus: UserStatus;\n    private readonly successRegex: RegExp = /(?:.*)Successfully .*login as (.*)/i;\n    private readonly failRegex: RegExp = /.*\\[ERROR\\].*/i;\n\n    constructor() {\n        super();\n        this.currentUser = undefined;\n        this.userStatus = UserStatus.SignedOut;\n        this.handleUriSignIn = this.handleUriSignIn.bind(this);\n    }\n\n    public async getLoginStatus(): Promise<void> {\n        try {\n            const result: string = await leetCodeExecutor.getUserInfo();\n            this.currentUser = this.tryParseUserName(result);\n            this.userStatus = UserStatus.SignedIn;\n        } catch (error) {\n            this.currentUser = undefined;\n            this.userStatus = UserStatus.SignedOut;\n            globalState.removeAll();\n        } finally {\n            this.emit(\"statusChanged\");\n        }\n    }\n\n    private async updateUserStatusWithCookie(cookie: string): Promise<void> {\n        globalState.setCookie(cookie);\n        const data = await queryUserData();\n        globalState.setUserStatus(data);\n        await this.setCookieToCli(cookie, data.username);\n        if (data.username) {\n            vscode.window.showInformationMessage(`Successfully ${data.username}.`);\n            this.currentUser = data.username;\n            this.userStatus = UserStatus.SignedIn;\n            this.emit(\"statusChanged\");\n        }\n    }\n\n    public async handleUriSignIn(uri: vscode.Uri): Promise<void> {\n        try {\n            await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification }, async (progress: vscode.Progress<{}>) => {\n                progress.report({ message: \"Fetching user data...\" });\n                const queryParams = parseQuery(uri.query);\n                const cookie = queryParams[\"cookie\"];\n                if (!cookie) {\n                    promptForOpenOutputChannel(`Failed to get cookie. Please log in again`, DialogType.error);\n                    return;\n                }\n\n                await this.updateUserStatusWithCookie(cookie)\n\n            });\n        } catch (error) {\n            promptForOpenOutputChannel(`Failed to log in. Please open the output channel for details`, DialogType.error);\n        }\n    }\n\n    public async handleInputCookieSignIn(): Promise<void> {\n        const cookie: string | undefined = await vscode.window.showInputBox({\n            prompt: 'Enter LeetCode Cookie',\n            password: true,\n            ignoreFocusOut: true,\n            validateInput: (s: string): string | undefined =>\n                s ? undefined : 'Cookie must not be empty',\n        })\n\n        await this.updateUserStatusWithCookie(cookie || '')\n    }\n\n    public async signIn(): Promise<void> {\n        const picks: Array<IQuickItemEx<string>> = []\n        picks.push(\n            {\n                label: 'Web Authorization',\n                detail: 'Open browser to authorize login on the website',\n                value: 'WebAuth',\n                description: '[Recommended]'\n            },\n            {\n                label: 'LeetCode Cookie',\n                detail: 'Use LeetCode cookie copied from browser to login',\n                value: 'Cookie',\n            }\n        )\n\n        const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick(picks)\n        if (!choice) {\n            return\n        }\n        const loginMethod: string = choice.value\n\n        if (loginMethod === 'WebAuth') {\n            openUrl(this.getAuthLoginUrl())\n            return\n        }\n\n        try {\n            await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: \"Fetching user data...\" }, async () => {\n                await this.handleInputCookieSignIn()\n            });\n        } catch (error) {\n            promptForOpenOutputChannel(`Failed to log in. Please open the output channel for details`, DialogType.error);\n        }\n    }\n\n    public async signOut(): Promise<void> {\n        try {\n            await leetCodeExecutor.signOut();\n            vscode.window.showInformationMessage(\"Successfully signed out.\");\n            this.currentUser = undefined;\n            this.userStatus = UserStatus.SignedOut;\n            globalState.removeAll();\n            this.emit(\"statusChanged\");\n        } catch (error) {\n            // swallow the error when sign out.\n        }\n    }\n\n    public getStatus(): UserStatus {\n        return this.userStatus;\n    }\n\n    public getUser(): string | undefined {\n        return this.currentUser;\n    }\n\n    private tryParseUserName(output: string): string {\n        const reg: RegExp = /^\\s*.\\s*(.+?)\\s*https:\\/\\/leetcode/m;\n        const match: RegExpMatchArray | null = output.match(reg);\n        if (match && match.length === 2) {\n            return match[1].trim();\n        }\n\n        return \"Unknown\";\n    }\n\n    public getAuthLoginUrl(): string {\n        switch (getLeetCodeEndpoint()) {\n            case Endpoint.LeetCodeCN:\n                return urlsCn.authLoginUrl;\n            case Endpoint.LeetCode:\n            default:\n                return urls.authLoginUrl;\n        }\n    }\n\n    public setCookieToCli(cookie: string, name: string): Promise<void> {\n        return new Promise(async (resolve: (res: void) => void, reject: (e: Error) => void) => {\n            const leetCodeBinaryPath: string = await leetCodeExecutor.getLeetCodeBinaryPath();\n\n            const childProc: cp.ChildProcess = wsl.useWsl()\n                ? cp.spawn(\"wsl\", [leetCodeExecutor.node, leetCodeBinaryPath, \"user\", loginArgsMapping.get(\"Cookie\") ?? \"\"], {\n                      shell: true,\n                  })\n                : cp.spawn(leetCodeExecutor.node, [leetCodeBinaryPath, \"user\", loginArgsMapping.get(\"Cookie\") ?? \"\"], {\n                      shell: true,\n                      env: createEnvOption(),\n                  });\n\n            childProc.stdout?.on(\"data\", async (data: string | Buffer) => {\n                data = data.toString();\n                leetCodeChannel.append(data);\n                const successMatch: RegExpMatchArray | null = data.match(this.successRegex);\n                if (successMatch && successMatch[1]) {\n                    childProc.stdin?.end();\n                    return resolve();\n                } else if (data.match(this.failRegex)) {\n                    childProc.stdin?.end();\n                    return reject(new Error(\"Faile to login\"));\n                } else if (data.match(/login: /)) {\n                    childProc.stdin?.write(`${name}\\n`);\n                } else if (data.match(/cookie: /)) {\n                    childProc.stdin?.write(`${cookie}\\n`);\n                }\n            });\n\n            childProc.stderr?.on(\"data\", (data: string | Buffer) => leetCodeChannel.append(data.toString()));\n\n            childProc.on(\"error\", reject);\n        });\n    }\n}\n\nexport const leetCodeManager: LeetCodeManager = new LeetCodeManager();\n"
  },
  {
    "path": "src/request/query-user-data.ts",
    "content": "import { UserDataType } from \"../globalState\";\nimport { getUrl } from \"../shared\";\nimport { LcAxios } from \"../utils/httpUtils\";\n\nconst graphqlStr = `\n    query globalData {\n        userStatus {\n            isPremium\n            isVerified\n            username\n            avatar\n            isSignedIn\n        }\n    }\n`;\n\nexport const queryUserData = async (): Promise<UserDataType> => {\n    return LcAxios(getUrl(\"userGraphql\"), {\n        method: \"POST\",\n        data: {\n            query: graphqlStr,\n            variables: {},\n        },\n    }).then((res) => res.data.data.userStatus);\n};\n"
  },
  {
    "path": "src/shared.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\n\nexport interface IQuickItemEx<T> extends vscode.QuickPickItem {\n    value: T;\n}\n\nexport enum UserStatus {\n    SignedIn = 1,\n    SignedOut = 2,\n}\n\nexport const loginArgsMapping: Map<string, string> = new Map([\n    [\"LeetCode\", \"-l\"],\n    [\"Cookie\", \"-c\"],\n    [\"GitHub\", \"-g\"],\n    [\"LinkedIn\", \"-i\"],\n]);\n\nexport const languages: string[] = [\n    \"bash\",\n    \"c\",\n    \"cpp\",\n    \"csharp\",\n    \"golang\",\n    \"java\",\n    \"javascript\",\n    \"kotlin\",\n    \"mysql\",\n    \"php\",\n    \"python\",\n    \"python3\",\n    \"ruby\",\n    \"rust\",\n    \"scala\",\n    \"swift\",\n    \"typescript\",\n];\n\nexport const langExt: Map<string, string> = new Map([\n    [\"bash\", \"sh\"],\n    [\"c\", \"c\"],\n    [\"cpp\", \"cpp\"],\n    [\"csharp\", \"cs\"],\n    [\"golang\", \"go\"],\n    [\"java\", \"java\"],\n    [\"javascript\", \"js\"],\n    [\"kotlin\", \"kt\"],\n    [\"mysql\", \"sql\"],\n    [\"php\", \"php\"],\n    [\"python\", \"py\"],\n    [\"python3\", \"py\"],\n    [\"ruby\", \"rb\"],\n    [\"rust\", \"rs\"],\n    [\"scala\", \"scala\"],\n    [\"swift\", \"swift\"],\n    [\"typescript\", \"ts\"],\n]);\n\nexport enum ProblemState {\n    AC = 1,\n    NotAC = 2,\n    Unknown = 3,\n    Locked = 4,\n}\n\nexport enum Endpoint {\n    LeetCode = \"leetcode\",\n    LeetCodeCN = \"leetcode-cn\",\n}\n\nexport interface IProblem {\n    isFavorite: boolean;\n    locked: boolean;\n    state: ProblemState;\n    id: string;\n    name: string;\n    difficulty: string;\n    passRate: string;\n    companies: string[];\n    tags: string[];\n}\n\nexport const defaultProblem: IProblem = {\n    isFavorite: false,\n    locked: false,\n    state: ProblemState.Unknown,\n    id: \"\",\n    name: \"\",\n    difficulty: \"\",\n    passRate: \"\",\n    companies: [] as string[],\n    tags: [] as string[],\n};\n\nexport enum Category {\n    All = \"All\",\n    Difficulty = \"Difficulty\",\n    Tag = \"Tag\",\n    Company = \"Company\",\n    Favorite = \"Favorite\",\n}\n\nexport const supportedPlugins: string[] = [\"company\", \"solution.discuss\", \"leetcode.cn\"];\n\nexport enum DescriptionConfiguration {\n    InWebView = \"In Webview\",\n    InFileComment = \"In File Comment\",\n    Both = \"Both\",\n    None = \"None\",\n}\n\nexport const leetcodeHasInited: string = \"leetcode.hasInited\";\n\nexport enum SortingStrategy {\n    None = \"None\",\n    AcceptanceRateAsc = \"Acceptance Rate (Ascending)\",\n    AcceptanceRateDesc = \"Acceptance Rate (Descending)\",\n    FrequencyAsc = \"Frequency (Ascending)\",\n    FrequencyDesc = \"Frequency (Descending)\",\n}\n\nexport const PREMIUM_URL_CN = \"https://leetcode.cn/premium-payment/?source=vscode\";\nexport const PREMIUM_URL_GLOBAL = \"https://leetcode.com/subscribe/?ref=lp_pl&source=vscode\";\n\nconst protocol = vscode.env.appName.includes('Insiders') ? \"vscode-insiders\" : \"vscode\"\n\nexport const urls = {\n    // base urls\n    base: \"https://leetcode.com\",\n    graphql: \"https://leetcode.com/graphql\",\n    userGraphql: \"https://leetcode.com/graphql\",\n    login: \"https://leetcode.com/accounts/login/\",\n    authLoginUrl: `https://leetcode.com/authorize-login/${protocol}/?path=leetcode.vscode-leetcode`,\n};\n\nexport const urlsCn = {\n    // base urls\n    base: \"https://leetcode.cn\",\n    graphql: \"https://leetcode.cn/graphql\",\n    userGraphql: \"https://leetcode.cn/graphql/\",\n    login: \"https://leetcode.cn/accounts/login/\",\n    authLoginUrl: `https://leetcode.cn/authorize-login/${protocol}/?path=leetcode.vscode-leetcode`,\n};\n\nexport const getUrl = (key: string) => {\n    const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n    const point = leetCodeConfig.get<string>(\"endpoint\", Endpoint.LeetCode);\n    switch (point) {\n        case Endpoint.LeetCodeCN:\n            return urlsCn[key];\n        case Endpoint.LeetCode:\n        default:\n            return urls[key];\n    }\n};\n"
  },
  {
    "path": "src/statusbar/LeetCodeStatusBarItem.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { UserStatus } from \"../shared\";\n\nexport class LeetCodeStatusBarItem implements vscode.Disposable {\n    private readonly statusBarItem: vscode.StatusBarItem;\n\n    constructor() {\n        this.statusBarItem = vscode.window.createStatusBarItem();\n        this.statusBarItem.command = \"leetcode.manageSessions\";\n    }\n\n    public updateStatusBar(status: UserStatus, user?: string): void {\n        switch (status) {\n            case UserStatus.SignedIn:\n                this.statusBarItem.text = `LeetCode: ${user}`;\n                break;\n            case UserStatus.SignedOut:\n            default:\n                this.statusBarItem.text = \"\";\n                break;\n        }\n    }\n\n    public show(): void {\n        this.statusBarItem.show();\n    }\n\n    public hide(): void {\n        this.statusBarItem.hide();\n    }\n\n    public dispose(): void {\n        this.statusBarItem.dispose();\n    }\n}\n"
  },
  {
    "path": "src/statusbar/leetCodeStatusBarController.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { ConfigurationChangeEvent, Disposable, workspace, WorkspaceConfiguration } from \"vscode\";\nimport { UserStatus } from \"../shared\";\nimport { LeetCodeStatusBarItem } from \"./LeetCodeStatusBarItem\";\n\nclass LeetCodeStatusBarController implements Disposable {\n    private statusBar: LeetCodeStatusBarItem;\n    private configurationChangeListener: Disposable;\n\n    constructor() {\n        this.statusBar = new LeetCodeStatusBarItem();\n        this.setStatusBarVisibility();\n\n        this.configurationChangeListener = workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {\n            if (event.affectsConfiguration(\"leetcode.enableStatusBar\")) {\n                this.setStatusBarVisibility();\n            }\n        }, this);\n    }\n\n    public updateStatusBar(status: UserStatus, user?: string): void {\n        this.statusBar.updateStatusBar(status, user);\n    }\n\n    public dispose(): void {\n        this.statusBar.dispose();\n        this.configurationChangeListener.dispose();\n    }\n\n    private setStatusBarVisibility(): void {\n        if (this.isStatusBarEnabled()) {\n            this.statusBar.show();\n        } else {\n            this.statusBar.hide();\n        }\n    }\n\n    private isStatusBarEnabled(): boolean {\n        const configuration: WorkspaceConfiguration = workspace.getConfiguration();\n        return configuration.get<boolean>(\"leetcode.enableStatusBar\", true);\n    }\n}\n\nexport const leetCodeStatusBarController: LeetCodeStatusBarController = new LeetCodeStatusBarController();\n"
  },
  {
    "path": "src/utils/cpUtils.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as cp from \"child_process\";\nimport * as vscode from \"vscode\";\nimport { leetCodeChannel } from \"../leetCodeChannel\";\n\ninterface IExecError extends Error {\n    result?: string;\n}\n\nexport async function executeCommand(command: string, args: string[], options: cp.SpawnOptions = { shell: true }): Promise<string> {\n    return new Promise((resolve: (res: string) => void, reject: (e: Error) => void): void => {\n        let result: string = \"\";\n\n        const childProc: cp.ChildProcess = cp.spawn(command, args, { ...options, env: createEnvOption() });\n\n        childProc.stdout?.on(\"data\", (data: string | Buffer) => {\n            data = data.toString();\n            result = result.concat(data);\n            leetCodeChannel.append(data);\n        });\n\n        childProc.stderr?.on(\"data\", (data: string | Buffer) => leetCodeChannel.append(data.toString()));\n\n        childProc.on(\"error\", reject);\n\n        childProc.on(\"close\", (code: number) => {\n            if (code !== 0 || result.indexOf(\"ERROR\") > -1) {\n                const error: IExecError = new Error(`Command \"${command} ${args.toString()}\" failed with exit code \"${code}\".`);\n                if (result) {\n                    error.result = result; // leetcode-cli may print useful content by exit with error code\n                }\n                reject(error);\n            } else {\n                resolve(result);\n            }\n        });\n    });\n}\n\nexport async function executeCommandWithProgress(message: string, command: string, args: string[], options: cp.SpawnOptions = { shell: true }): Promise<string> {\n    let result: string = \"\";\n    await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification }, async (p: vscode.Progress<{}>) => {\n        return new Promise<void>(async (resolve: () => void, reject: (e: Error) => void): Promise<void> => {\n            p.report({ message });\n            try {\n                result = await executeCommand(command, args, options);\n                resolve();\n            } catch (e) {\n                reject(e);\n            }\n        });\n    });\n    return result;\n}\n\n// clone process.env and add http proxy\nexport function createEnvOption(): {} {\n    const proxy: string | undefined = getHttpAgent();\n    if (proxy) {\n        const env: any = Object.create(process.env);\n        env.http_proxy = proxy;\n        return env;\n    }\n    return process.env;\n}\n\nfunction getHttpAgent(): string | undefined {\n    return vscode.workspace.getConfiguration(\"http\").get<string>(\"proxy\");\n}\n"
  },
  {
    "path": "src/utils/httpUtils.ts",
    "content": "import axios, { AxiosRequestConfig, AxiosPromise } from \"axios\";\nimport { omit } from \"lodash\";\nimport { globalState } from \"../globalState\";\nimport { DialogType, promptForOpenOutputChannel } from \"./uiUtils\";\n\nconst referer = \"vscode-lc-extension\";\n\nexport function LcAxios<T = any>(path: string, settings?: AxiosRequestConfig): AxiosPromise<T> {\n    const cookie = globalState.getCookie();\n    if (!cookie) {\n        promptForOpenOutputChannel(\n            `Failed to obtain the cookie. Please log in again.`,\n            DialogType.error\n        );\n        return Promise.reject(\"Failed to obtain the cookie.\");\n    }\n    return axios(path, {\n        headers: {\n            referer,\n            \"content-type\": \"application/json\",\n            cookie,\n            ...(settings && settings.headers),\n        },\n        xsrfCookieName: \"csrftoken\",\n        xsrfHeaderName: \"X-CSRFToken\",\n        ...(settings && omit(settings, \"headers\")),\n    });\n}\n"
  },
  {
    "path": "src/utils/osUtils.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nexport function isWindows(): boolean {\n    return process.platform === \"win32\";\n}\n\nexport function usingCmd(): boolean {\n    const comSpec: string | undefined = process.env.ComSpec;\n    // 'cmd.exe' is used as a fallback if process.env.ComSpec is unavailable.\n    if (!comSpec) {\n        return true;\n    }\n\n    if (comSpec.indexOf(\"cmd.exe\") > -1) {\n        return true;\n    }\n    return false;\n}\n"
  },
  {
    "path": "src/utils/problemUtils.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as fse from \"fs-extra\";\nimport * as _ from \"lodash\";\nimport * as path from \"path\";\nimport { IProblem, langExt } from \"../shared\";\n\nexport function genFileExt(language: string): string {\n    const ext: string | undefined = langExt.get(language);\n    if (!ext) {\n        throw new Error(`The language \"${language}\" is not supported.`);\n    }\n    return ext;\n}\n\nexport function genFileName(node: IProblem, language: string): string {\n    const slug: string = _.kebabCase(node.name);\n    const ext: string = genFileExt(language);\n    return `${node.id}.${slug}.${ext}`;\n}\n\nexport async function getNodeIdFromFile(fsPath: string): Promise<string> {\n    const fileContent: string = await fse.readFile(fsPath, \"utf8\");\n    let id: string = \"\";\n    const matchResults: RegExpMatchArray | null = fileContent.match(/@lc.+id=(.+?) /);\n    if (matchResults && matchResults.length === 2) {\n        id = matchResults[1];\n    }\n    // Try to get id from file name if getting from comments failed\n    if (!id) {\n        id = path.basename(fsPath).split(\".\")[0];\n    }\n\n    return id;\n}\n"
  },
  {
    "path": "src/utils/settingUtils.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { workspace, WorkspaceConfiguration } from \"vscode\";\nimport { DescriptionConfiguration } from \"../shared\";\n\nexport function getWorkspaceConfiguration(): WorkspaceConfiguration {\n    return workspace.getConfiguration(\"leetcode\");\n}\n\nexport function shouldHideSolvedProblem(): boolean {\n    return getWorkspaceConfiguration().get<boolean>(\"hideSolved\", false);\n}\n\nexport function getWorkspaceFolder(): string {\n    return getWorkspaceConfiguration().get<string>(\"workspaceFolder\", \"\");\n}\n\nexport function getEditorShortcuts(): string[] {\n    return getWorkspaceConfiguration().get<string[]>(\"editor.shortcuts\", [\"submit\", \"test\"]);\n}\n\nexport function hasStarShortcut(): boolean {\n    const shortcuts: string[] = getWorkspaceConfiguration().get<string[]>(\"editor.shortcuts\", [\"submit\", \"test\"]);\n    return shortcuts.indexOf(\"star\") >= 0;\n}\n\nexport function shouldUseEndpointTranslation(): boolean {\n    return getWorkspaceConfiguration().get<boolean>(\"useEndpointTranslation\", true);\n}\n\nexport function getDescriptionConfiguration(): IDescriptionConfiguration {\n    const setting: string = getWorkspaceConfiguration().get<string>(\"showDescription\", DescriptionConfiguration.InWebView);\n    const config: IDescriptionConfiguration = {\n        showInComment: false,\n        showInWebview: true,\n    };\n    switch (setting) {\n        case DescriptionConfiguration.Both:\n            config.showInComment = true;\n            config.showInWebview = true;\n            break;\n        case DescriptionConfiguration.None:\n            config.showInComment = false;\n            config.showInWebview = false;\n            break;\n        case DescriptionConfiguration.InFileComment:\n            config.showInComment = true;\n            config.showInWebview = false;\n            break;\n        case DescriptionConfiguration.InWebView:\n            config.showInComment = false;\n            config.showInWebview = true;\n            break;\n    }\n\n    // To be compatible with the deprecated setting:\n    if (getWorkspaceConfiguration().get<boolean>(\"showCommentDescription\")) {\n        config.showInComment = true;\n    }\n\n    return config;\n}\n\nexport interface IDescriptionConfiguration {\n    showInComment: boolean;\n    showInWebview: boolean;\n}\n"
  },
  {
    "path": "src/utils/toolUtils.ts",
    "content": "export function sleep(ms) {\n    return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function parseQuery(query: string): { [key: string]: string } {\n    const queryObject: { [key: string]: string } = {};\n\n    if (!query) {\n        return queryObject;\n    }\n\n    const keyValuePairs = query.split(\"&\");\n    keyValuePairs.forEach((pair) => {\n        const firstEqualsIndex = pair.indexOf(\"=\");\n        if (firstEqualsIndex !== -1) {\n            const key = pair.substring(0, firstEqualsIndex);\n            const value = pair.substring(firstEqualsIndex + 1);\n            queryObject[decodeURIComponent(key)] = decodeURIComponent(value);\n        } else {\n            // If no equals sign is found, treat the whole string as key with empty value\n            queryObject[decodeURIComponent(pair)] = \"\";\n        }\n    });\n\n    return queryObject;\n}\n"
  },
  {
    "path": "src/utils/trackingUtils.ts",
    "content": "import * as vscode from \"vscode\";\nimport axios from \"axios\";\nimport { getLeetCodeEndpoint } from \"../commands/plugin\";\nimport { Endpoint } from \"../shared\";\nimport { leetCodeManager } from \"../leetCodeManager\";\n\nconst getTimeZone = (): string => {\n    const endPoint: string = getLeetCodeEndpoint();\n    if (endPoint === Endpoint.LeetCodeCN) {\n        return \"Asia/Shanghai\";\n    } else {\n        return \"UTC\";\n    }\n};\n\ninterface IReportData {\n    event_key: string;\n    type?: \"click\" | \"expose\" | string;\n    anonymous_id?: string;\n    tid?: number;\n    ename?: string; // event name\n    href?: string;\n    referer?: string;\n    extra?: string;\n    target?: string;\n}\n\ninterface ITrackData {\n    reportCache: IReportData[];\n    isSubmit: boolean;\n    report: (reportItems: IReportData | IReportData[]) => void;\n    submitReport: (useSendBeason: boolean) => Promise<void>;\n    reportUrl: string;\n}\n\nconst testReportUrl = \"https://analysis.lingkou.xyz/i/event\";\nconst prodReportUrl = \"https://analysis.leetcode.cn/i/event\";\n\nfunction getReportUrl() {\n    if (process.env.NODE_ENV === \"production\") {\n        return prodReportUrl;\n    } else {\n        return testReportUrl;\n    }\n}\n\nconst _charStr = \"abacdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+=\";\n\nfunction RandomIndex(min: number, max: number, i: number) {\n    let index = Math.floor(Math.random() * (max - min + 1) + min);\n    const numStart = _charStr.length - 10;\n    if (i === 0 && index >= numStart) {\n        index = RandomIndex(min, max, i);\n    }\n    return index;\n}\n\nfunction getRandomString(len: number) {\n    const min = 0;\n    const max = _charStr.length - 1;\n    let _str = \"\";\n    len = len || 15;\n    for (let i = 0, index; i < len; i++) {\n        index = RandomIndex(min, max, i);\n        _str += _charStr[index];\n    }\n    return _str;\n}\n\nfunction getAllowReportDataConfig() {\n    const leetCodeConfig = vscode.workspace.getConfiguration(\"leetcode\");\n    const allowReportData = !!leetCodeConfig.get<boolean>(\"allowReportData\");\n    return allowReportData;\n}\n\nclass TrackData implements ITrackData {\n    public reportCache: IReportData[] = [];\n\n    public isSubmit: boolean = false;\n\n    public reportUrl: string = getReportUrl();\n\n    private sendTimer: NodeJS.Timeout | undefined;\n\n    public report = (reportItems: IReportData | IReportData[]) => {\n        if (!getAllowReportDataConfig()) return;\n\n        this.sendTimer && clearTimeout(this.sendTimer);\n\n        if (!Array.isArray(reportItems)) {\n            reportItems = [reportItems];\n        }\n        const randomId = getRandomString(60);\n        reportItems.forEach((item) => {\n            this.reportCache.push({\n                ...item,\n                referer: \"vscode\",\n                target: leetCodeManager.getUser() ?? \"\",\n                anonymous_id: item.anonymous_id ?? (randomId as string),\n            });\n        });\n        this.sendTimer = setTimeout(this.submitReport, 800);\n    };\n\n    public submitReport = async () => {\n        if (!getAllowReportDataConfig()) return;\n        const dataList = JSON.stringify(this.reportCache);\n\n        if (!this.reportCache.length || this.isSubmit) {\n            return;\n        }\n        this.reportCache = [];\n        try {\n            this.isSubmit = true;\n            axios.defaults.withCredentials = true;\n            await axios.post(this.reportUrl, `dataList=${encodeURIComponent(dataList)}`, {\n                headers: {\n                    \"Content-Type\": \"application/x-www-form-urlencoded\",\n                    \"x-timezone\": getTimeZone(),\n                },\n            });\n        } catch (e) {\n            this.reportCache = this.reportCache.concat(JSON.parse(dataList));\n        } finally {\n            this.isSubmit = false;\n        }\n    };\n}\n\nexport default new TrackData();\n"
  },
  {
    "path": "src/utils/uiUtils.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { getLeetCodeEndpoint } from \"../commands/plugin\";\nimport { leetCodeChannel } from \"../leetCodeChannel\";\nimport { getWorkspaceConfiguration } from \"./settingUtils\";\n\nexport namespace DialogOptions {\n    export const open: vscode.MessageItem = { title: \"Open\" };\n    export const yes: vscode.MessageItem = { title: \"Yes\" };\n    export const no: vscode.MessageItem = { title: \"No\", isCloseAffordance: true };\n    export const never: vscode.MessageItem = { title: \"Never\" };\n    export const singUp: vscode.MessageItem = { title: \"Sign up\" };\n}\n\nexport async function promptForOpenOutputChannel(message: string, type: DialogType): Promise<void> {\n    let result: vscode.MessageItem | undefined;\n    switch (type) {\n        case DialogType.info:\n            result = await vscode.window.showInformationMessage(message, DialogOptions.open, DialogOptions.no);\n            break;\n        case DialogType.warning:\n            result = await vscode.window.showWarningMessage(message, DialogOptions.open, DialogOptions.no);\n            break;\n        case DialogType.error:\n            result = await vscode.window.showErrorMessage(message, DialogOptions.open, DialogOptions.no);\n            break;\n        default:\n            break;\n    }\n\n    if (result === DialogOptions.open) {\n        leetCodeChannel.show();\n    }\n}\n\nexport async function promptForSignIn(): Promise<void> {\n    const choice: vscode.MessageItem | undefined = await vscode.window.showInformationMessage(\n        \"Please sign in to LeetCode.\",\n        DialogOptions.yes,\n        DialogOptions.no,\n        DialogOptions.singUp,\n    );\n    switch (choice) {\n        case DialogOptions.yes:\n            await vscode.commands.executeCommand(\"leetcode.signin\");\n            break;\n        case DialogOptions.singUp:\n            if (getLeetCodeEndpoint()) {\n                openUrl(\"https://leetcode.cn\");\n            } else {\n                openUrl(\"https://leetcode.com\");\n            }\n            break;\n        default:\n            break;\n    }\n}\n\nexport async function promptHintMessage(config: string, message: string, choiceConfirm: string, onConfirm: () => Promise<any>): Promise<void> {\n    if (getWorkspaceConfiguration().get<boolean>(config)) {\n        const choiceNoShowAgain: string = \"Don't show again\";\n        const choice: string | undefined = await vscode.window.showInformationMessage(\n            message, choiceConfirm, choiceNoShowAgain,\n        );\n        if (choice === choiceConfirm) {\n            await onConfirm();\n        } else if (choice === choiceNoShowAgain) {\n            await getWorkspaceConfiguration().update(config, false, true /* UserSetting */);\n        }\n    }\n}\n\nexport async function openSettingsEditor(query?: string): Promise<void> {\n    await vscode.commands.executeCommand(\"workbench.action.openSettings\", query);\n}\n\nexport async function openKeybindingsEditor(query?: string): Promise<void> {\n    await vscode.commands.executeCommand(\"workbench.action.openGlobalKeybindings\", query);\n}\n\nexport async function showFileSelectDialog(fsPath?: string): Promise<vscode.Uri[] | undefined> {\n    const defaultUri: vscode.Uri | undefined = getBelongingWorkspaceFolderUri(fsPath);\n    const options: vscode.OpenDialogOptions = {\n        defaultUri,\n        canSelectFiles: true,\n        canSelectFolders: false,\n        canSelectMany: false,\n        openLabel: \"Select\",\n    };\n    return await vscode.window.showOpenDialog(options);\n}\n\nfunction getBelongingWorkspaceFolderUri(fsPath: string | undefined): vscode.Uri | undefined {\n    let defaultUri: vscode.Uri | undefined;\n    if (fsPath) {\n        const workspaceFolder: vscode.WorkspaceFolder | undefined = vscode.workspace.getWorkspaceFolder(vscode.Uri.file(fsPath));\n        if (workspaceFolder) {\n            defaultUri = workspaceFolder.uri;\n        }\n    }\n    return defaultUri;\n}\n\nexport async function showDirectorySelectDialog(fsPath?: string): Promise<vscode.Uri[] | undefined> {\n    const defaultUri: vscode.Uri | undefined = getBelongingWorkspaceFolderUri(fsPath);\n    const options: vscode.OpenDialogOptions = {\n        defaultUri,\n        canSelectFiles: false,\n        canSelectFolders: true,\n        canSelectMany: false,\n        openLabel: \"Select\",\n    };\n    return await vscode.window.showOpenDialog(options);\n}\n\nexport async function openUrl(url: string): Promise<void> {\n    vscode.commands.executeCommand(\"vscode.open\", vscode.Uri.parse(url));\n}\n\nexport enum DialogType {\n    info = \"info\",\n    warning = \"warning\",\n    error = \"error\",\n}\n"
  },
  {
    "path": "src/utils/workspaceUtils.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as fse from \"fs-extra\";\nimport * as os from \"os\";\nimport * as path from \"path\";\nimport * as vscode from \"vscode\";\nimport { IQuickItemEx } from \"../shared\";\nimport { getWorkspaceConfiguration, getWorkspaceFolder } from \"./settingUtils\";\nimport { showDirectorySelectDialog } from \"./uiUtils\";\nimport * as wsl from \"./wslUtils\";\n\nexport async function selectWorkspaceFolder(): Promise<string> {\n    let workspaceFolderSetting: string = getWorkspaceFolder();\n    if (workspaceFolderSetting.trim() === \"\") {\n        workspaceFolderSetting = await determineLeetCodeFolder();\n        if (workspaceFolderSetting === \"\") {\n            // User cancelled\n            return workspaceFolderSetting;\n        }\n    }\n    let needAsk: boolean = true;\n    await fse.ensureDir(workspaceFolderSetting);\n    for (const folder of vscode.workspace.workspaceFolders || []) {\n        if (isSubFolder(folder.uri.fsPath, workspaceFolderSetting)) {\n            needAsk = false;\n        }\n    }\n\n    if (needAsk) {\n        const choice: string | undefined = await vscode.window.showQuickPick(\n            [\n                OpenOption.justOpenFile,\n                OpenOption.openInCurrentWindow,\n                OpenOption.openInNewWindow,\n                OpenOption.addToWorkspace,\n            ],\n            { placeHolder: \"The LeetCode workspace folder is not opened in VS Code, would you like to open it?\" },\n        );\n\n        // Todo: generate file first\n        switch (choice) {\n            case OpenOption.justOpenFile:\n                return workspaceFolderSetting;\n            case OpenOption.openInCurrentWindow:\n                await vscode.commands.executeCommand(\"vscode.openFolder\", vscode.Uri.file(workspaceFolderSetting), false);\n                return \"\";\n            case OpenOption.openInNewWindow:\n                await vscode.commands.executeCommand(\"vscode.openFolder\", vscode.Uri.file(workspaceFolderSetting), true);\n                return \"\";\n            case OpenOption.addToWorkspace:\n                vscode.workspace.updateWorkspaceFolders(vscode.workspace.workspaceFolders?.length ?? 0, 0, { uri: vscode.Uri.file(workspaceFolderSetting) });\n                break;\n            default:\n                return \"\";\n        }\n    }\n\n    return wsl.useWsl() ? wsl.toWslPath(workspaceFolderSetting) : workspaceFolderSetting;\n}\n\nexport async function getActiveFilePath(uri?: vscode.Uri): Promise<string | undefined> {\n    let textEditor: vscode.TextEditor | undefined;\n    if (uri) {\n        textEditor = await vscode.window.showTextDocument(uri, { preview: false });\n    } else {\n        textEditor = vscode.window.activeTextEditor;\n    }\n\n    if (!textEditor) {\n        return undefined;\n    }\n    if (textEditor.document.isDirty && !await textEditor.document.save()) {\n        vscode.window.showWarningMessage(\"Please save the solution file first.\");\n        return undefined;\n    }\n    return wsl.useWsl() ? wsl.toWslPath(textEditor.document.uri.fsPath) : textEditor.document.uri.fsPath;\n}\n\nfunction isSubFolder(from: string, to: string): boolean {\n    const relative: string = path.relative(from, to);\n    if (relative === \"\") {\n        return true;\n    }\n    return !relative.startsWith(\"..\") && !path.isAbsolute(relative);\n}\n\nasync function determineLeetCodeFolder(): Promise<string> {\n    let result: string;\n    const picks: Array<IQuickItemEx<string>> = [];\n    picks.push(\n        {\n            label: `Default location`,\n            detail: `${path.join(os.homedir(), \".leetcode\")}`,\n            value: `${path.join(os.homedir(), \".leetcode\")}`,\n        },\n        {\n            label: \"$(file-directory) Browse...\",\n            value: \":browse\",\n        },\n    );\n    const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick(\n        picks,\n        { placeHolder: \"Select where you would like to save your LeetCode files\" },\n    );\n    if (!choice) {\n        result = \"\";\n    } else if (choice.value === \":browse\") {\n        const directory: vscode.Uri[] | undefined = await showDirectorySelectDialog();\n        if (!directory || directory.length < 1) {\n            result = \"\";\n        } else {\n            result = directory[0].fsPath;\n        }\n    } else {\n        result = choice.value;\n    }\n\n    getWorkspaceConfiguration().update(\"workspaceFolder\", result, vscode.ConfigurationTarget.Global);\n\n    return result;\n}\n\nenum OpenOption {\n    justOpenFile = \"Just open the problem file\",\n    openInCurrentWindow = \"Open in current window\",\n    openInNewWindow = \"Open in new window\",\n    addToWorkspace = \"Add to workspace\",\n}\n"
  },
  {
    "path": "src/utils/wslUtils.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as vscode from \"vscode\";\nimport { executeCommand } from \"./cpUtils\";\nimport { isWindows } from \"./osUtils\";\n\nexport function useWsl(): boolean {\n    const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"leetcode\");\n    return isWindows() && leetCodeConfig.get<boolean>(\"useWsl\") === true;\n}\n\nexport async function toWslPath(path: string): Promise<string> {\n    return (await executeCommand(\"wsl\", [\"wslpath\", \"-u\", `\"${path.replace(/\\\\/g, \"/\")}\"`])).trim();\n}\n\nexport async function toWinPath(path: string): Promise<string> {\n    if (path.startsWith(\"\\\\mnt\\\\\")) {\n        return (await executeCommand(\"wsl\", [\"wslpath\", \"-w\", `\"${path.replace(/\\\\/g, \"/\").substr(0, 6)}\"`])).trim() + path.substr(7);\n    }\n    return (await executeCommand(\"wsl\", [\"wslpath\", \"-w\", \"/\"])).trim() + path;\n}\n"
  },
  {
    "path": "src/webview/LeetCodeWebview.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { commands, ConfigurationChangeEvent, Disposable, ViewColumn, WebviewPanel, window, workspace } from \"vscode\";\nimport { openSettingsEditor, promptHintMessage } from \"../utils/uiUtils\";\nimport { markdownEngine } from \"./markdownEngine\";\n\nexport abstract class LeetCodeWebview implements Disposable {\n\n    protected readonly viewType: string = \"leetcode.webview\";\n    protected panel: WebviewPanel | undefined;\n    private listeners: Disposable[] = [];\n\n    public dispose(): void {\n        if (this.panel) {\n            this.panel.dispose();\n        }\n    }\n\n    protected showWebviewInternal(): void {\n        const { title, viewColumn, preserveFocus } = this.getWebviewOption();\n        if (!this.panel) {\n            this.panel = window.createWebviewPanel(this.viewType, title, { viewColumn, preserveFocus }, {\n                enableScripts: true,\n                enableCommandUris: true,\n                enableFindWidget: true,\n                retainContextWhenHidden: true,\n                localResourceRoots: markdownEngine.localResourceRoots,\n            });\n            this.panel.onDidDispose(this.onDidDisposeWebview, this, this.listeners);\n            this.panel.webview.onDidReceiveMessage(this.onDidReceiveMessage, this, this.listeners);\n            workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, this.listeners);\n        } else {\n            this.panel.title = title;\n            if (viewColumn === ViewColumn.Two) {\n                // Make sure second group exists. See vscode#71608 issue\n                commands.executeCommand(\"workbench.action.focusSecondEditorGroup\").then(() => {\n                    this.panel!.reveal(viewColumn, preserveFocus);\n                });\n            } else {\n                this.panel.reveal(viewColumn, preserveFocus);\n            }\n        }\n        this.panel.webview.html = this.getWebviewContent();\n        this.showMarkdownConfigHint();\n    }\n\n    protected onDidDisposeWebview(): void {\n        this.panel = undefined;\n        for (const listener of this.listeners) {\n            listener.dispose();\n        }\n        this.listeners = [];\n    }\n\n    protected async onDidChangeConfiguration(event: ConfigurationChangeEvent): Promise<void> {\n        if (this.panel && event.affectsConfiguration(\"markdown\")) {\n            this.panel.webview.html = this.getWebviewContent();\n        }\n    }\n\n    protected async onDidReceiveMessage(_message: any): Promise<void> { /* no special rule */ }\n\n    protected abstract getWebviewOption(): ILeetCodeWebviewOption;\n\n    protected abstract getWebviewContent(): string;\n\n    private async showMarkdownConfigHint(): Promise<void> {\n        await promptHintMessage(\n            \"hint.configWebviewMarkdown\",\n            'You can change the webview appearance (\"fontSize\", \"lineWidth\" & \"fontFamily\") in \"markdown.preview\" configuration.',\n            \"Open settings\",\n            (): Promise<any> => openSettingsEditor(\"markdown.preview\"),\n        );\n    }\n}\n\nexport interface ILeetCodeWebviewOption {\n    title: string;\n    viewColumn: ViewColumn;\n    preserveFocus?: boolean;\n}\n"
  },
  {
    "path": "src/webview/leetCodePreviewProvider.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { commands, ViewColumn } from \"vscode\";\nimport { getLeetCodeEndpoint } from \"../commands/plugin\";\nimport { Endpoint, IProblem } from \"../shared\";\nimport { ILeetCodeWebviewOption, LeetCodeWebview } from \"./LeetCodeWebview\";\nimport { markdownEngine } from \"./markdownEngine\";\n\nclass LeetCodePreviewProvider extends LeetCodeWebview {\n    protected readonly viewType: string = \"leetcode.preview\";\n    private node: IProblem;\n    private description: IDescription;\n    private sideMode: boolean = false;\n\n    public isSideMode(): boolean {\n        return this.sideMode;\n    }\n\n    public show(descString: string, node: IProblem, isSideMode: boolean = false): void {\n        this.description = this.parseDescription(descString, node);\n        this.node = node;\n        this.sideMode = isSideMode;\n        this.showWebviewInternal();\n    }\n\n    protected getWebviewOption(): ILeetCodeWebviewOption {\n        if (!this.sideMode) {\n            return {\n                title: `${this.node.name}: Preview`,\n                viewColumn: ViewColumn.One,\n            };\n        } else {\n            return {\n                title: \"Description\",\n                viewColumn: ViewColumn.Two,\n                preserveFocus: true,\n            };\n        }\n    }\n\n    protected getWebviewContent(): string {\n        const button: { element: string; script: string; style: string } = {\n            element: `<button id=\"solve\">Code Now</button>`,\n            script: `const button = document.getElementById('solve');\n                    button.onclick = () => vscode.postMessage({\n                        command: 'ShowProblem',\n                    });`,\n            style: `<style>\n                #solve {\n                    position: fixed;\n                    bottom: 1rem;\n                    right: 1rem;\n                    border: 0;\n                    margin: 1rem 0;\n                    padding: 0.2rem 1rem;\n                    color: white;\n                    background-color: var(--vscode-button-background);\n                }\n                #solve:hover {\n                    background-color: var(--vscode-button-hoverBackground);\n                }\n                #solve:active {\n                    border: 0;\n                }\n                </style>`,\n        };\n        const { title, url, category, difficulty, likes, dislikes, body } = this.description;\n        const head: string = markdownEngine.render(`# [${title}](${url})`);\n        const info: string = markdownEngine.render(\n            [\n                `| Category | Difficulty | Likes | Dislikes |`,\n                `| :------: | :--------: | :---: | :------: |`,\n                `| ${category} | ${difficulty} | ${likes} | ${dislikes} |`,\n            ].join(\"\\n\")\n        );\n        const tags: string = [\n            `<details>`,\n            `<summary><strong>Tags</strong></summary>`,\n            markdownEngine.render(this.description.tags.map((t: string) => `[\\`${t}\\`](${this.getTagLink(t)})`).join(\" | \")),\n            `</details>`,\n        ].join(\"\\n\");\n        const companies: string = [\n            `<details>`,\n            `<summary><strong>Companies</strong></summary>`,\n            markdownEngine.render(this.description.companies.map((c: string) => `\\`${c}\\``).join(\" | \")),\n            `</details>`,\n        ].join(\"\\n\");\n        const links: string = markdownEngine.render(`[Submissions](${this.getSubmissionsLink(url)}) | [Solution](${this.getSolutionsLink(url)})`);\n        return `\n            <!DOCTYPE html>\n            <html>\n            <head>\n                <meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; img-src https:; script-src vscode-resource: 'unsafe-inline'; style-src vscode-resource: 'unsafe-inline';\"/>\n                ${markdownEngine.getStyles()}\n                ${!this.sideMode ? button.style : \"\"}\n                <style>\n                    code { white-space: pre-wrap; }\n                </style>\n            </head>\n            <body>\n                ${head}\n                ${info}\n                ${tags}\n                ${companies}\n                ${body}\n                <hr />\n                ${links}\n                ${!this.sideMode ? button.element : \"\"}\n                <script>\n                    const vscode = acquireVsCodeApi();\n                    ${!this.sideMode ? button.script : \"\"}\n                </script>\n            </body>\n            </html>\n        `;\n    }\n\n    protected onDidDisposeWebview(): void {\n        super.onDidDisposeWebview();\n        this.sideMode = false;\n    }\n\n    protected async onDidReceiveMessage(message: IWebViewMessage): Promise<void> {\n        switch (message.command) {\n            case \"ShowProblem\": {\n                await commands.executeCommand(\"leetcode.showProblem\", this.node);\n                break;\n            }\n        }\n    }\n\n    // private async hideSideBar(): Promise<void> {\n    //     await commands.executeCommand(\"workbench.action.focusSideBar\");\n    //     await commands.executeCommand(\"workbench.action.toggleSidebarVisibility\");\n    // }\n\n    private parseDescription(descString: string, problem: IProblem): IDescription {\n        const [\n            ,\n            ,\n            /* title */ url,\n            ,\n            ,\n            ,\n            ,\n            ,\n            /* tags */ /* langs */ category,\n            difficulty,\n            likes,\n            dislikes,\n            ,\n            ,\n            ,\n            ,\n            /* accepted */ /* submissions */ /* testcase */ ...body\n        ] = descString.split(\"\\n\");\n        return {\n            title: problem.name,\n            url,\n            tags: problem.tags,\n            companies: problem.companies,\n            category: category.slice(2),\n            difficulty: difficulty.slice(2),\n            likes: likes.split(\": \")[1].trim(),\n            dislikes: dislikes.split(\": \")[1].trim(),\n            body: body.join(\"\\n\").replace(/<pre>[\\r\\n]*([^]+?)[\\r\\n]*<\\/pre>/g, \"<pre><code>$1</code></pre>\"),\n        };\n    }\n\n    private getTagLink(tag: string): string {\n        const endPoint: string = getLeetCodeEndpoint();\n        if (endPoint === Endpoint.LeetCodeCN) {\n            return `https://leetcode.cn/tag/${tag}?source=vscode`;\n        } else if (endPoint === Endpoint.LeetCode) {\n            return `https://leetcode.com/tag/${tag}?source=vscode`;\n        }\n\n        return \"https://leetcode.com?source=vscode\";\n    }\n\n    private getSolutionsLink(url: string): string {\n        return url.replace(\"/description/\", \"/solutions/\") + \"?source=vscode\";\n    }\n    private getSubmissionsLink(url: string): string {\n        return url.replace(\"/description/\", \"/submissions/\") + \"?source=vscode\";\n    }\n}\n\ninterface IDescription {\n    title: string;\n    url: string;\n    tags: string[];\n    companies: string[];\n    category: string;\n    difficulty: string;\n    likes: string;\n    dislikes: string;\n    body: string;\n}\n\ninterface IWebViewMessage {\n    command: string;\n}\n\nexport const leetCodePreviewProvider: LeetCodePreviewProvider = new LeetCodePreviewProvider();\n"
  },
  {
    "path": "src/webview/leetCodeSolutionProvider.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { ViewColumn } from \"vscode\";\nimport { leetCodePreviewProvider } from \"./leetCodePreviewProvider\";\nimport { ILeetCodeWebviewOption, LeetCodeWebview } from \"./LeetCodeWebview\";\nimport { markdownEngine } from \"./markdownEngine\";\n\nclass LeetCodeSolutionProvider extends LeetCodeWebview {\n\n    protected readonly viewType: string = \"leetcode.solution\";\n    private problemName: string;\n    private solution: Solution;\n\n    public show(solutionString: string): void {\n        this.solution = this.parseSolution(solutionString);\n        this.showWebviewInternal();\n    }\n\n    protected getWebviewOption(): ILeetCodeWebviewOption {\n        if (leetCodePreviewProvider.isSideMode()) {\n            return {\n                title: \"Solution\",\n                viewColumn: ViewColumn.Two,\n                preserveFocus: true,\n            };\n        } else {\n            return {\n                title: `Solution: ${this.problemName}`,\n                viewColumn: ViewColumn.One,\n            };\n        }\n    }\n\n    protected getWebviewContent(): string {\n        const styles: string = markdownEngine.getStyles();\n        const { title, url, lang, author, votes } = this.solution;\n        const head: string = markdownEngine.render(`# [${title}](${url})`);\n        const auth: string = `[${author}](https://leetcode.com/${author}/)`;\n        const info: string = markdownEngine.render([\n            `| Language |  Author  |  Votes   |`,\n            `| :------: | :------: | :------: |`,\n            `| ${lang}  | ${auth}  | ${votes} |`,\n        ].join(\"\\n\"));\n        const body: string = markdownEngine.render(this.solution.body, {\n            lang: this.solution.lang,\n            host: \"https://discuss.leetcode.com/\",\n        });\n        return `\n            <!DOCTYPE html>\n            <html>\n            <head>\n                <meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; img-src https:; script-src vscode-resource:; style-src vscode-resource:;\"/>\n                ${styles}\n            </head>\n            <body class=\"vscode-body 'scrollBeyondLastLine' 'wordWrap' 'showEditorSelection'\" style=\"tab-size:4\">\n                ${head}\n                ${info}\n                ${body}\n            </body>\n            </html>\n        `;\n    }\n\n    protected onDidDisposeWebview(): void {\n        super.onDidDisposeWebview();\n    }\n\n    private parseSolution(raw: string): Solution {\n        raw = raw.slice(1); // skip first empty line\n        [this.problemName, raw] = raw.split(/\\n\\n([^]+)/); // parse problem name and skip one line\n        const solution: Solution = new Solution();\n        // [^] matches everything including \\n, yet can be replaced by . in ES2018's `m` flag\n        [solution.title, raw] = raw.split(/\\n\\n([^]+)/);\n        [solution.url, raw] = raw.split(/\\n\\n([^]+)/);\n        [solution.lang, raw] = raw.match(/\\* Lang:\\s+(.+)\\n([^]+)/)!.slice(1);\n        [solution.author, raw] = raw.match(/\\* Author:\\s+(.+)\\n([^]+)/)!.slice(1);\n        [solution.votes, raw] = raw.match(/\\* Votes:\\s+(\\d+)\\n\\n([^]+)/)!.slice(1);\n        solution.body = raw;\n        return solution;\n    }\n}\n\n// tslint:disable-next-line:max-classes-per-file\nclass Solution {\n    public title: string = \"\";\n    public url: string = \"\";\n    public lang: string = \"\";\n    public author: string = \"\";\n    public votes: string = \"\";\n    public body: string = \"\"; // Markdown supported\n}\n\nexport const leetCodeSolutionProvider: LeetCodeSolutionProvider = new LeetCodeSolutionProvider();\n"
  },
  {
    "path": "src/webview/leetCodeSubmissionProvider.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport { ViewColumn } from \"vscode\";\nimport { openKeybindingsEditor, promptHintMessage } from \"../utils/uiUtils\";\nimport { ILeetCodeWebviewOption, LeetCodeWebview } from \"./LeetCodeWebview\";\nimport { markdownEngine } from \"./markdownEngine\";\n\nclass LeetCodeSubmissionProvider extends LeetCodeWebview {\n\n    protected readonly viewType: string = \"leetcode.submission\";\n    private result: IResult;\n\n    public show(resultString: string): void {\n        this.result = this.parseResult(resultString);\n        this.showWebviewInternal();\n        this.showKeybindingsHint();\n    }\n\n    protected getWebviewOption(): ILeetCodeWebviewOption {\n        return {\n            title: \"Submission\",\n            viewColumn: ViewColumn.Two,\n        };\n    }\n\n    protected getWebviewContent(): string {\n        const styles: string = markdownEngine.getStyles();\n        const title: string = `## ${this.result.messages[0]}`;\n        const messages: string[] = this.result.messages.slice(1).map((m: string) => `* ${m}`);\n        const sections: string[] = Object.keys(this.result)\n            .filter((key: string) => key !== \"messages\")\n            .map((key: string) => [\n                `### ${key}`,\n                \"```\",\n                this.result[key].join(\"\\n\"),\n                \"```\",\n            ].join(\"\\n\"));\n        const body: string = markdownEngine.render([\n            title,\n            ...messages,\n            ...sections,\n        ].join(\"\\n\"));\n        return `\n            <!DOCTYPE html>\n            <html>\n            <head>\n                <meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; img-src https:; script-src vscode-resource:; style-src vscode-resource:;\"/>\n                <meta charset=\"UTF-8\">\n                <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n                ${styles}\n            </head>\n            <body class=\"vscode-body 'scrollBeyondLastLine' 'wordWrap' 'showEditorSelection'\" style=\"tab-size:4\">\n                ${body}\n            </body>\n            </html>\n        `;\n    }\n\n    protected onDidDisposeWebview(): void {\n        super.onDidDisposeWebview();\n    }\n\n    private async showKeybindingsHint(): Promise<void> {\n        await promptHintMessage(\n            \"hint.commandShortcut\",\n            'You can customize shortcut key bindings in File > Preferences > Keyboard Shortcuts with query \"leetcode\".',\n            \"Open Keybindings\",\n            (): Promise<any> => openKeybindingsEditor(\"leetcode solution\"),\n        );\n    }\n\n    private parseResult(raw: string): IResult {\n        raw = raw.concat(\"  √ \"); // Append a dummy sentinel to the end of raw string\n        const regSplit: RegExp = /  [√×✔✘vx] ([^]+?)\\n(?=  [√×✔✘vx] )/g;\n        const regKeyVal: RegExp = /(.+?): ([^]*)/;\n        const result: IResult = { messages: [] };\n        let entry: RegExpExecArray | null;\n        do {\n            entry = regSplit.exec(raw);\n            if (!entry) {\n                continue;\n            }\n            const kvMatch: RegExpExecArray | null = regKeyVal.exec(entry[1]);\n            if (kvMatch) {\n                const [key, value] = kvMatch.slice(1);\n                if (value) { // Do not show empty string\n                    if (!result[key]) {\n                        result[key] = [];\n                    }\n                    result[key].push(value);\n                }\n            } else {\n                result.messages.push(entry[1]);\n            }\n        } while (entry);\n        return result;\n    }\n}\n\ninterface IResult {\n    [key: string]: string[];\n    messages: string[];\n}\n\nexport const leetCodeSubmissionProvider: LeetCodeSubmissionProvider = new LeetCodeSubmissionProvider();\n"
  },
  {
    "path": "src/webview/markdownEngine.ts",
    "content": "// Copyright (c) jdneo. All rights reserved.\n// Licensed under the MIT license.\n\nimport * as hljs from \"highlight.js\";\nimport * as MarkdownIt from \"markdown-it\";\nimport * as os from \"os\";\nimport * as path from \"path\";\nimport * as vscode from \"vscode\";\nimport { leetCodeChannel } from \"../leetCodeChannel\";\nimport { isWindows } from \"../utils/osUtils\";\n\nclass MarkdownEngine implements vscode.Disposable {\n\n    private engine: MarkdownIt;\n    private config: MarkdownConfiguration;\n    private listener: vscode.Disposable;\n\n    public constructor() {\n        this.reload();\n        this.listener = vscode.workspace.onDidChangeConfiguration((event: vscode.ConfigurationChangeEvent) => {\n            if (event.affectsConfiguration(\"markdown\")) {\n                this.reload();\n            }\n        }, this);\n    }\n\n    public get localResourceRoots(): vscode.Uri[] {\n        return [vscode.Uri.file(path.join(this.config.extRoot, \"media\"))];\n    }\n\n    public dispose(): void {\n        this.listener.dispose();\n    }\n\n    public reload(): void {\n        this.engine = this.initEngine();\n        this.config = new MarkdownConfiguration();\n    }\n\n    public render(md: string, env?: any): string {\n        return this.engine.render(md, env);\n    }\n\n    public getStyles(): string {\n        return [\n            this.getBuiltinStyles(),\n            this.getSettingsStyles(),\n        ].join(os.EOL);\n    }\n\n    private getBuiltinStyles(): string {\n        let styles: vscode.Uri[] = [];\n        try {\n            const stylePaths: string[] = require(path.join(this.config.extRoot, \"package.json\"))[\"contributes\"][\"markdown.previewStyles\"];\n            styles = stylePaths.map((p: string) => vscode.Uri.file(path.join(this.config.extRoot, p)).with({ scheme: \"vscode-resource\" }));\n        } catch (error) {\n            leetCodeChannel.appendLine(\"[Error] Fail to load built-in markdown style file.\");\n        }\n        return styles.map((style: vscode.Uri) => `<link rel=\"stylesheet\" type=\"text/css\" href=\"${style.toString()}\">`).join(os.EOL);\n    }\n\n    private getSettingsStyles(): string {\n        return [\n            `<style>`,\n            `body {`,\n            `    ${this.config.fontFamily ? `font-family: ${this.config.fontFamily};` : ``}`,\n            `    ${isNaN(this.config.fontSize) ? `` : `font-size: ${this.config.fontSize}px;`}`,\n            `    ${isNaN(this.config.lineHeight) ? `` : `line-height: ${this.config.lineHeight};`}`,\n            `}`,\n            `</style>`,\n        ].join(os.EOL);\n    }\n\n    private initEngine(): MarkdownIt {\n        const md: MarkdownIt = new MarkdownIt({\n            linkify: true,\n            typographer: true,\n            highlight: (code: string, lang?: string): string => {\n                switch (lang && lang.toLowerCase()) {\n                    case \"mysql\":\n                        lang = \"sql\"; break;\n                    case \"json5\":\n                        lang = \"json\"; break;\n                    case \"python3\":\n                        lang = \"python\"; break;\n                }\n                if (lang && hljs.getLanguage(lang)) {\n                    try {\n                        return hljs.highlight(lang, code, true).value;\n                    } catch (error) { /* do not highlight */ }\n                }\n                return \"\"; // use external default escaping\n            },\n        });\n\n        this.addCodeBlockHighlight(md);\n        this.addImageUrlCompletion(md);\n        this.addLinkValidator(md);\n        return md;\n    }\n\n    private addCodeBlockHighlight(md: MarkdownIt): void {\n        const codeBlock: MarkdownIt.TokenRender = md.renderer.rules[\"code_block\"];\n        // tslint:disable-next-line:typedef\n        md.renderer.rules[\"code_block\"] = (tokens, idx, options, env, self) => {\n            // if any token uses lang-specified code fence, then do not highlight code block\n            if (tokens.some((token: any) => token.type === \"fence\")) {\n                return codeBlock(tokens, idx, options, env, self);\n            }\n            // otherwise, highlight with default lang in env object.\n            const highlighted: string = options.highlight(tokens[idx].content, env.lang);\n            return [\n                `<pre><code ${self.renderAttrs(tokens[idx])} >`,\n                highlighted || md.utils.escapeHtml(tokens[idx].content),\n                \"</code></pre>\",\n            ].join(os.EOL);\n        };\n    }\n\n    private addImageUrlCompletion(md: MarkdownIt): void {\n        const image: MarkdownIt.TokenRender = md.renderer.rules[\"image\"];\n        // tslint:disable-next-line:typedef\n        md.renderer.rules[\"image\"] = (tokens, idx, options, env, self) => {\n            const imageSrc: string[] | undefined = tokens[idx].attrs.find((value: string[]) => value[0] === \"src\");\n            if (env.host && imageSrc && imageSrc[1].startsWith(\"/\")) {\n                imageSrc[1] = `${env.host}${imageSrc[1]}`;\n            }\n            return image(tokens, idx, options, env, self);\n        };\n    }\n\n    private addLinkValidator(md: MarkdownIt): void {\n        const validateLink: (link: string) => boolean = md.validateLink;\n        md.validateLink = (link: string): boolean => {\n            // support file:// protocal link\n            return validateLink(link) || link.startsWith(\"file:\");\n        };\n    }\n}\n\n// tslint:disable-next-line: max-classes-per-file\nclass MarkdownConfiguration {\n\n    public readonly extRoot: string; // root path of vscode built-in markdown extension\n    public readonly lineHeight: number;\n    public readonly fontSize: number;\n    public readonly fontFamily: string;\n\n    public constructor() {\n        const markdownConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(\"markdown\", null);\n        this.extRoot = path.join(vscode.env.appRoot, \"extensions\", \"markdown-language-features\");\n        this.lineHeight = Math.max(0.6, +markdownConfig.get<number>(\"preview.lineHeight\", NaN));\n        this.fontSize = Math.max(8, +markdownConfig.get<number>(\"preview.fontSize\", NaN));\n        this.fontFamily = this.resolveFontFamily(markdownConfig);\n    }\n\n    private resolveFontFamily(config: vscode.WorkspaceConfiguration): string {\n        let fontFamily: string = config.get<string>(\"preview.fontFamily\", \"\");\n        if (isWindows() && fontFamily === config.inspect<string>(\"preview.fontFamily\")!.defaultValue) {\n            fontFamily = `${fontFamily}, 'Microsoft Yahei UI'`;\n        }\n        return fontFamily;\n    }\n}\n\nexport const markdownEngine: MarkdownEngine = new MarkdownEngine();\n"
  },
  {
    "path": "thirdpartynotice.txt",
    "content": "THIRD-PARTY SOFTWARE NOTICES AND INFORMATION\nFor vscode-leetcode extension\n\nThis extension uses Open Source components. You can find the source code of their\nopen source projects along with the license information below. We acknowledge and\nare grateful to these developers for their contribution to open source.\n\n1. fs-extra (https://github.com/jprichardson/node-fs-extra)\n2. highlight.js (https://github.com/highlightjs/highlight.js/)\n3. require-from-string (https://github.com/floatdrop/require-from-string)\n4. lodash (https://github.com/lodash/lodash)\n5. markdown-it (https://github.com/markdown-it/markdown-it)\n6. leetcode-cli (https://github.com/skygragon/leetcode-cli)\n7. unescape-js (https://github.com/iamakulov/unescape-js)\n\nfs-extra NOTICES BEGIN HERE\n=============================\n\n(The MIT License)\n\nCopyright (c) 2011-2017 JP Richardson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files\n(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,\n merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\nOR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nEND OF fs-extra NOTICES AND INFORMATION\n==================================\n\nhighlight.js NOTICES BEGIN HERE\n=============================\n\nCopyright (c) 2006, Ivan Sagalaev\nAll rights reserved.\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the name of highlight.js nor the names of its contributors\n      may be used to endorse or promote products derived from this software\n      without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nEND OF highlight.js NOTICES AND INFORMATION\n==================================\n\nrequire-from-string NOTICES BEGIN HERE\n=============================\n\nThe MIT License (MIT)\n\nCopyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\nEND OF require-from-string NOTICES AND INFORMATION\n==================================\n\nlodash NOTICES BEGIN HERE\n=============================\n\nThe MIT License\n\nCopyright JS Foundation and other contributors <https://js.foundation/>\n\nBased on Underscore.js, copyright Jeremy Ashkenas,\nDocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>\n\nThis software consists of voluntary contributions made by many\nindividuals. For exact contribution history, see the revision history\navailable at https://github.com/lodash/lodash\n\nThe following license applies to all parts of this software except as\ndocumented below:\n\n====\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n====\n\nCopyright and related rights for sample code are waived via CC0. Sample\ncode is defined as all source code displayed within the prose of the\ndocumentation.\n\nCC0: http://creativecommons.org/publicdomain/zero/1.0/\n\n====\n\nFiles located in the node_modules and vendor directories are externally\nmaintained libraries used by this software which have their own\nlicenses; we recommend you read them, as their terms may differ from the\nterms above.\n\nEND OF lodash NOTICES AND INFORMATION\n==================================\n\nmarkdown-it NOTICES BEGIN HERE\n=============================\n\nCopyright (c) 2014 Vitaly Puzrin, Alex Kocharin.\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nEND OF markdown-it NOTICES AND INFORMATION\n==================================\n\nleetcode-cli NOTICES BEGIN HERE\n=============================\n\nMIT License\n\nCopyright (c) 2016 skygragon\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nEND OF leetcode-cli NOTICES AND INFORMATION\n==================================\n\nunescape-js NOTICES BEGIN HERE\n=============================\n\nThe MIT License (MIT)\n\nCopyright (c) Ivan Akulov <mail@iamakulov.com> (http://iamakulov.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\nEND OF unescape-js NOTICES AND INFORMATION\n==================================\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n    \"compilerOptions\": {\n        \"module\": \"commonjs\",\n        \"target\": \"es6\",\n        \"outDir\": \"out\",\n        \"lib\": [\n            \"es6\"\n        ],\n        \"sourceMap\": true,\n        \"rootDir\": \".\",\n        \"noUnusedLocals\": true,\n        \"noImplicitThis\": true,\n        \"noImplicitReturns\": true,\n        \"strictNullChecks\": true,\n        \"noUnusedParameters\": true,\n        \"alwaysStrict\": true\n    },\n    \"exclude\": [\n        \"node_modules\",\n        \".vscode-test\"\n    ]\n}\n"
  },
  {
    "path": "tslint.json",
    "content": "{\n    \"defaultSeverity\": \"error\",\n    \"extends\": [\"tslint:recommended\"],\n    \"jsRules\": {},\n    \"rules\": {\n        \"object-literal-sort-keys\": false,\n        \"ordered-imports\": [false],\n        \"indent\": [true, \"spaces\"],\n        \"no-string-literal\": false,\n        \"no-namespace\": false,\n        \"max-line-length\": [false, 120],\n        \"typedef\": false,\n        \"no-implicit-dependencies\": [true, [\"vscode\"]],\n        \"trailing-comma\": false,\n        \"no-any\": false,\n        \"object-literal-key-quotes\": [true, \"consistent-as-needed\"],\n        \"prefer-object-spread\": false,\n        \"no-unnecessary-await\": false,\n        \"semicolon\": [false],\n        \"quotemark\": [false],\n        \"member-ordering\": [false],\n        \"variable-name\": [false],\n        \"curly\": false,\n        \"interface-over-type-literal\": [false],\n        \"no-unused-expression\": false\n    },\n    \"rulesDirectory\": []\n}\n"
  }
]