LeetCode-OpenSource/vscode-leetcode

I cannot submit or test my code properly when I am working on Question 59.

bestchenyan opened this issue ยท 1 comments

๐Ÿ› Bug Report

I cannot submit or test my code properly when I am working on Question 59.The error is as follows:
image

To Reproduce

The same code can be successfully submitted on the LeetCode website. The code is as follows:

var generateMatrix = function (n) {
  let output = new Array(n).fill(0).map(() => new Array(n).fill(0));
  let count = 0;
  let size = n * n;
  let left = 0;
  let right = n - 1;
  let top = 0;
  let bottom = n - 1;
  while (count < size) {
    //going left
    for (let i = left; i <= right; i++) {
      count++;
      output[top][i] = count;
    }
    top++;

    // going down
    for (let i = top; i <= bottom; i++) {
      count++;
      output[i][right] = count;
    }
    right--;

    //going left
    for (let i = right; i >= left; i--) {
      count++;
      output[bottom][i] = count;
    }
    bottom--;

    //going up
    for (let i = bottom; i >= top; i--) {
      count++;
      output[i][left] = count;
    }
    left++;
  }

  return output;
};

image

Expected behavior

The code can be submitted successfully in LeetCode extension.

Extension Output

  • Waiting for judge result
  • Waiting for judge result
  • Waiting for judge result
    undefined:1
<script>var _0x49a6=['wyeCN','4|2|0|3|1','wQzOV','split','iTyzs','pCQRM','cookie','location.href=location.href.replace(/[?|&]tads/,\x20\x27\x27)','WTKkN','bOYDu','dtzqS'];(function(a,c){var b=function(b){while(--b){a['push'](a['shift']());}};b(++c);}(_0x49a6,0x147));var _0x649a=function(a,c){a=a-0x0;var b=_0x49a6[a];return b;};function a(){var a={'WTKkN':2280229037,'bOYDu':5710729,'dtzqS':function d(a,b){return a+b;},'wyeCN':1360566322,'pCQRM':function e(a){return a();}};var b=0x0;b+=a[_0x649a('0x0')];b+=a[_0x649a('0x1')];b=a[_0x649a('0x2')](b,a[_0x649a('0x3')]);function c(){var b={'wQzOV':_0x649a('0x4'),'iTyzs':function e(a,b){return a+b;}};var c=b[_0x649a('0x5')][_0x649a('0x6')]('|'),d=0x0;while(!![]){switch(c[d++]){case'0':a+=0xd9;continue;case'1':return a;continue;case'2':a+=0xa4;continue;case'3':a=b[_0x649a('0x7')](a,0x1c0);continue;case'4':var a=0x0;continue;}break;}}return a[_0x649a('0x8')](c),b;}document[_0x649a('0x9')]='__tst_status='+a()+'#;';setTimeout(_0x649a('0xa'),0x4b0);</script>

^

SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Request._callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\vsc-leetcode-cli\lib\plugins\leetcode.js:231:23)
at Request.self.callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:185:22)
at Request.emit (events.js:400:28)
at Request. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1161:10)
at Request.emit (events.js:400:28)
at IncomingMessage. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1333:12)

  • Waiting for judge result
    undefined:1
<script>var _0x49a6=['wyeCN','4|2|0|3|1','wQzOV','split','iTyzs','pCQRM','cookie','location.href=location.href.replace(/[?|&]tads/,\x20\x27\x27)','WTKkN','bOYDu','dtzqS'];(function(a,c){var b=function(b){while(--b){a['push'](a['shift']());}};b(++c);}(_0x49a6,0x147));var _0x649a=function(a,c){a=a-0x0;var b=_0x49a6[a];return b;};function a(){var a={'WTKkN':3326441960,'bOYDu':174111951,'dtzqS':function d(a,b){return a+b;},'wyeCN':145952177,'pCQRM':function e(a){return a();}};var b=0x0;b+=a[_0x649a('0x0')];b+=a[_0x649a('0x1')];b=a[_0x649a('0x2')](b,a[_0x649a('0x3')]);function c(){var b={'wQzOV':_0x649a('0x4'),'iTyzs':function e(a,b){return a+b;}};var c=b[_0x649a('0x5')][_0x649a('0x6')]('|'),d=0x0;while(!![]){switch(c[d++]){case'0':a+=0xd9;continue;case'1':return a;continue;case'2':a+=0xa4;continue;case'3':a=b[_0x649a('0x7')](a,0x1c0);continue;case'4':var a=0x0;continue;}break;}}return a[_0x649a('0x8')](c),b;}document[_0x649a('0x9')]='__tst_status='+a()+'#;';setTimeout(_0x649a('0xa'),0x4b0);</script>

^

SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Request._callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\vsc-leetcode-cli\lib\plugins\leetcode.js:231:23)
at Request.self.callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:185:22)
at Request.emit (events.js:400:28)
at Request. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1161:10)
at Request.emit (events.js:400:28)
at IncomingMessage. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1333:12)

  • Sending code to judge
    (node:12396) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
    (Use node --trace-warnings ... to show where the warning was created)
    [ERROR] http error [code=429]

Your Environment

  • os:Windows11 x64

  • extension settings:
    // Add difficulty badge and colorize problems files in explorer tree.
    "leetcode.colorizeProblems": true,

    // Default language for solving the problems.
    "leetcode.defaultLanguage": "",

    // Customize the shortcuts in editors.
    // - submit: Submit your answer to LeetCode.
    // - test: Test your answer with customized test cases.
    // - star: Star or unstar the current problem.
    // - solution: Show the top voted solution for the current problem.
    // - description: Show the problem description page.
    "leetcode.editor.shortcuts": [
    "submit",
    "test"
    ],

    // Determine whether to group all webview pages into the second editor column when solving problems.
    "leetcode.enableSideMode": true,

    // Show the LeetCode status bar or not.
    "leetcode.enableStatusBar": true,

    // Endpoint of the user account.
    "leetcode.endpoint": "leetcode",

    // The output folder and filename to save the problem files.
    "leetcode.filePath": {
    "default": {
    "folder": "",
    "filename": "${id}.${kebab-case-name}.${ext}"
    }
    },

    // Hide solved problems.
    "leetcode.hideSolved": false,

    // Show a hint to configure commands key binding.
    "leetcode.hint.commandShortcut": true,

    // Show a hint to enable comment description in solution code file.
    "leetcode.hint.commentDescription": true,

    // Show a hint to change webview appearance through markdown config.
    "leetcode.hint.configWebviewMarkdown": true,

    // Show a hint to set the default language.
    "leetcode.hint.setDefaultLanguage": true,

    // The Node.js executable path. for example, C:\Program Files\nodejs\node.exe
    "leetcode.nodePath": "node",

    // Sorting strategy for problems list.
    "leetcode.problems.sortStrategy": "None",

    // This setting will be deprecated in 0.17.0, please use 'leetcode.showDescription' instead
    // [Deprecated] Include problem description in comments.
    "leetcode.showCommentDescription": false,

    // Specify where to show the description.
    // - In Webview: Show the problem description in a new webview window
    // - In File Comment: Show the problem description in the file's comment
    "leetcode.showDescription": "In Webview",

    // Show locked problems.
    "leetcode.showLocked": false,

    // Use endpoint's translation (if available)
    "leetcode.useEndpointTranslation": true,

    // Use the Windows Subsystem for Linux.
    "leetcode.useWsl": false,

    // The path of the workspace folder to store the problem files.
    "leetcode.workspaceFolder": "",

  • nodejs version: v14.21.3

  • vscode version: v1.79.0

  • extension version: 0.18.1

Sorry,, it's my fault.
My lang setting was incorrect. It should have been 'javascript'. When I did a global replace, I replaced the letter 'j' with the letter 'y'.