GithubHelp home page GithubHelp logo

dhanus3133 / leetbuddy.nvim Goto Github PK

View Code? Open in Web Editor NEW
141.0 141.0 15.0 78 KB

Solve Leetcode problems within Neovim ๐Ÿ”ฅ

License: MIT License

Lua 100.00%
neovim neovim-plugin nvim-plugin plugin

leetbuddy.nvim's Introduction

Currently what I'm working on!

Discord Presence


โšก Recent Activity:

Last Updated: Wednesday, July 3rd, 2024, 6:05:50 PM

  1. โฌ†๏ธ Pushed 1 commit(s) to Dhanus3133/graphql-benchmarks
  2. โฌ†๏ธ Pushed 1 commit(s) to Dhanus3133/graphql-benchmarks
  3. โฌ†๏ธ Pushed 12 commit(s) to Dhanus3133/graphql-benchmarks
  4. โฌ†๏ธ Pushed 1 commit(s) to Dhanus3133/graphql-benchmarks
  5. โฌ†๏ธ Pushed 13 commit(s) to Dhanus3133/graphql-benchmarks

Monkeytype Stats

Monkeytype Profile

Wakatime Stats

Code Time

Lines of code

๐Ÿ“Š This Week I Spent My Time On

๐Ÿ•‘๏ธŽ Time Zone: Asia/Kolkata

๐Ÿ’ฌ Programming Languages: 
Other                    5 hrs 8 mins        โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   33.29 % 
Bash                     4 hrs 50 mins       โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   31.34 % 
TypeScript               2 hrs 3 mins        โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   13.37 % 
Python                   1 hr 10 mins        โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   07.59 % 
JavaScript               34 mins             โ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   03.71 % 

๐Ÿ”ฅ Editors: 
Neovim                   10 hrs 22 mins      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   67.22 % 
fish                     5 hrs 3 mins        โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   32.78 % 

I Mostly Code in Python

Python                   24 repos            โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   33.80 % 
TypeScript               15 repos            โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   21.13 % 
JavaScript               9 repos             โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   12.68 % 
Lua                      3 repos             โ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   04.23 % 
Go                       2 repos             โ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   02.82 % 

Last Updated on 03/07/2024 19:02:46 UTC


Overall Stats

Counter

leetbuddy.nvim's People

Contributors

8vestory avatar binarybrain11 avatar dhanus3133 avatar namtx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

leetbuddy.nvim's Issues

post code load function

Custom callback function execution after loading the any question from LBQuestions on the code buffer.
Use case 1: user can resolve the empty code buffer problem. The custom callback function can detect if buffer is empty and call :LBReset automatically.
Use case 2: by default the lsp on cpp gives errors. Leetcode assume using namespace std but doesn't show that in the code. A user can parse the text and return a new code string with some changes such as string -> std::string, vector -> std::vector and so on (including appropriate header files and ).

For the both the use cases, a post code load callback can give user flexibility to change the code according to how he/she wants.

input.txt shows only one test case

Everything works fine except for the input.txt.
It only shows one test case and runs one test with the one that is in the input.txt.

Is there something I've missed setting up?
BTW, thanks a lot for such a plugin.

Screenshot 2023-08-14 at 8 22 21 PM Pass Screenshot 2023-08-14 at 8 25 45 PM Fail

Run test code or Submit Code got some error

Hello, thanks for supporting leetcode.cn.
It's ok when I run 0001-two-sum and submit it.
But when I run 1049-last-stone-weight-ii locally get error below:

Error executing vim.schedule lua callback: ...share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/display.lua:115: attempt to get length of l
ocal 'std_output' (a nil value)
stack traceback:
        ...share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/display.lua:115: in function 'display_results'
        .../share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/runner.lua:88: in function 'check_id'
        .../share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/runner.lua:103: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

When I submit 1049-last-stone-weight-ii get error below:

Error executing vim.schedule lua callback: ...share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/display.lua:136: attempt to call global 'P'
 (a nil value)
stack traceback:
        ...share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/display.lua:136: in function 'display_results'
        .../share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/runner.lua:88: in function 'check_id'
        .../share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/runner.lua:103: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

And also a little issue.
1, when I finish one question and use cmd "<leader>lq" to find and switch a new one the input.txt is not update.
2, when I open the old question the cursor will focus on the output window.

And how to close the popup window after cmd "<leader>ll", I use "ctrl+w q" to close the popup window, is there any convenient way?

Thanks for your job!

Can't List Any Questions with domain cn

Hello,
this is my configuration in neovim
{
"Dhanus3133/LeetBuddy.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
config = function()
require("leetbuddy").setup({
language = "py",
domain = "cn"
})
end,

keys = {
  { "<leader>lq", "<cmd>LBQuestions<cr>", desc = "List Questions" },
  { "<leader>ll", "<cmd>LBQuestion<cr>", desc = "View Question" },
  { "<leader>lr", "<cmd>LBReset<cr>", desc = "Reset Code" },
  { "<leader>lt", "<cmd>LBTest<cr>", desc = "Run Code" },
  { "<leader>ls", "<cmd>LBSubmit<cr>", desc = "Submit Code" },
},

}
just add 'domain="cn"', I can login with my account but cannot find any questions when I use lq command.

Feature Request: Have the question as a file

Hi, thanks for the plugin!

May I suggest having an option to have the Question description as a file? It's useful because we can open it as a tab and quick switch to it.

We would have the following files:

exercise.rs
input.txt
question.txt

Post request fails to write

i am using opensuse, and my curl version is

curl 7.82.0 (x86_64-conda-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1n zlib/1.2.12 libssh2/1.10.0 nghttp2/1.46.0
Release-Date: 2022-03-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets

but i still have such err

Error executing Lua callback: ...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:498: 'curl -sSL -D /run/user/1000//plenary_curl_cb9c41a5.headers --compressed -X POST -H Cookie: LEETCODE_SESSION=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJfYXV0aF91c2VyX2lkIjoiMjgwNTEwIiwiX2F1dGhfdXNlcl9iYWNrZW5kIjoiZGphbmdvLmNvbnRyaWIuYXV0aC5iYWNrZW5kcy5Nb2RlbEJhY2tlbmQiLCJfYXV0aF91c2VyX2hhc2giOiI0NGMzYmUwNjQ5ZTM4OWVmOWNiNDIwNmZblabalbal(i just hide the session)
IjSvWEJz9LtflDyd3r9XK4brXUTXL -H Content-Type: application/json -H Accept: application/json -H Referer: https://leetcode.cn --data-raw {"query":"    query globalData {\n      userStatus {\n        isSignedIn\n
       username\n      }\n    }\n  "} https://leetcode.cn/graphql' was unable to complete in 10000 ms
stack traceback:
        [C]: in function 'error'
        ...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:498: in function 'wait'
        ...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:452: in function 'sync'
        ...vim/site/pack/lazy/opt/plenary.nvim/lua/plenary/curl.lua:292: in function 'post'
        ...e/pack/lazy/opt/LeetBuddy.nvim/lua/leetbuddy/cookies.lua:75: in function <...e/pack/lazy/opt/LeetBuddy.nvim/lua/leetbuddy/cookies.lua:49>

Error executing luv callback:
...vim/site/pack/lazy/opt/plenary.nvim/lua/plenary/curl.lua:274: post https://leetcode.cn/graphql - curl error exit_code=23 stderr={ "curl: (23) Failed writing received data to disk/application" }
stack traceback:
        [C]: in function 'error'
        ...vim/site/pack/lazy/opt/plenary.nvim/lua/plenary/curl.lua:274: in function '_user_on_exit'
        ...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:239: in function '_shutdown'
        ...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:46: in function <...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:37>
        [C]: in function 'wait'
        ...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:485: in function 'wait'
        ...rvim/site/pack/lazy/opt/plenary.nvim/lua/plenary/job.lua:452: in function 'sync'
        ...vim/site/pack/lazy/opt/plenary.nvim/lua/plenary/curl.lua:292: in function 'post'
        ...e/pack/lazy/opt/LeetBuddy.nvim/lua/leetbuddy/cookies.lua:75: in function <...e/pack/lazy/opt/LeetBuddy.nvim/lua/leetbuddy/cookies.lua:49>

Post request fails to write

I get this whenever I try to sign in, I think it's a permission issue but I haven't been able to resolve it yet, any help would be appreciated.

Error executing luv callback: ....local/share/nvim/lazy/plenary.nvim/lua/plenary/curl.lua:274: post leetcode.com/graphql - curl error exit_code=23 stderr={ "curl: (23) Failed writing received data to disk/application" } stack traceback: [C]: in function 'error' ....local/share/nvim/lazy/plenary.nvim/lua/plenary/curl.lua:274: in function '_user_on_exit' .../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job.lua:239: in function '_shutdown' .../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job.lua:46: in function <.../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job.lua:37> [C]: in function 'wait' .../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job.lua:485: in function 'wait' .../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job.lua:452: in function 'sync' ....local/share/nvim/lazy/plenary.nvim/lua/plenary/curl.lua:292: in function 'post' ...share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/cookies.lua:75: in function <...share/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/cookies.lua:49> [C]: in function 'nvim_exec2' vim/_editor.lua: in function 'cmd' ...are/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/questions.lua:160: in function <...are/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/questions.lua:159>

LBQuestions not work after reinstall

After reinstalling the plugin, :LBQuestions does not work, and the input will report an error:

E5108: Error executing lua: ...are/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/questions.lua:129: attempt to index local 'problem' (a nil value)
stack traceback:
	...are/nvim/lazy/LeetBuddy.nvim/lua/leetbuddy/questions.lua:129: in function 'key_func'
	...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:257: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:256>

Starter code not loading

I am the following configuration:

require('leetbuddy').setup({
domain = "com",
language = "cpp",
})

While loading some questions (tested for 1000, 1071, 1072), the starter code buffer is empty.
It works for others such as (1, 2, 1005) the code buffer has starter code.

Why would this be happening?

[FIXED] Timeout when validating cookies

I have entered all the cookies etc. and when it is trying to verify Ig: I receive connection timeout 1000ms and after that another error that --compressed as parameter to some cUrl function isnt supported.

I am on Windows.

[Edit]
I did look up the other issues and updated curl by creating a new folder with the newer version and putting that in system env.
Now I get the following error:

grafik

And then:

grafik

suggest and some question

  1. suggest
    I looked the video and i think the leetcode request ( which info of test) is should'nt pop up it's should more flat with code for read and code is working at sametime.
  2. question
  • is the data leetcode autoupdate?
  • How process is going done? ( any big update or something cause i look your extension is really awesome but i not start leetcode yet just in plan)
  1. Thank you and keep it up. Good job guys

Wrong window split, fixed.

When I started leetbuddy the coding window ended up being the small bottom right one and the input one being the largest one taking half the screen on the left.
Fixed it by adding this line in the split.lua:31 file to rotate the window after the first v split and before the second split.
vim.cmd("wincmd x")

Window layout different

I opened nvim followed by :LBQuestions followed by selecting any question.
On my nvim, the input.txt opened on the left and right side is divided into executable on top and code window on the bottom.

Do I need to set something explicitly?

My init file has:

    use {
      'Dhanus3133/Leetbuddy.nvim',
      requires = {
        'nvim-lua/plenary.nvim',
        'nvim-telescope/telescope.nvim',
      },
      config = function()
        require('leetbuddy').setup({
          domain = "com",
          language = "cpp",
        })
      end,
    }

Thanks

image

Extremely laggy

I wanted to try using this plugin but it is lagging a lot (like 3-5 seconds after every keypress).

I thought it might be somehow conflicting with one of the other plugins I had, but the issue still occurred with a minimal config.

I gave my minimal config to a friend and this project ran fine for them. Any idea how I would go about finding the issue and fixing it?

Thank you

How to trigger login?

Hello there. Hope you're doing well. Thank you for creating this plugin. The vim emulator in the official website sucks big time.

However, I have trouble using this plugin. After installing, I don't have the trigger to input the cookie and the CSRF token. I see the ~/.leetcode directory created but it's empty inside. Can I manually create the file and input the token into the file?

Thank you again!

Tests not working

Hello, I was extremely happy that I seemingly finally set up Leetbuddy.
But now after writing some test code for a problem and running :LBTest, I do not receive any response even after like 5 minutes or so and only the green text saying Executing.... is visible. In the background it must be still loading with curl or so.. cause I can not do anything else - neovim quite much freezes.

grafik

LSP doesn't work for Rust

If you change language to Rust, then LSP features don't work. I'm using basically the default install of LazyVim with Rust-tools. LSP info says that rust-analyzer is attached to the buffer. I believe that the lsp doesn't know it should be running on the file because the file isn't in the module tree its looking at. It needs a mod.rs or main.rs additionally the file are written with dashes as a separator and rust won't like that either. Additionally execution hangs after attempting to submit code

Filter by difficulty

Hi! First of all I want to say thank you for this plugin.

However my current flow looks like this:

  • Open browser
  • Open leetcode
  • Search by difficulty (and maybe other params)
  • Find a problem I like
  • Open terminal
  • Open Nvim
  • Paste the name of the problem into your plugin
  • Start solving the problem

I'd like to simplify it as follows:

  • Open terminal
  • Open Nvim
  • Search/filter problem
  • Find problem I like
  • Start solving the problem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.