Dhanus3133 / Leetbuddy.nvim

Solve Leetcode problems within Neovim 🔥
MIT License
138 stars 15 forks source link

Can ony see 20 questions #32

Closed arorashivoy closed 11 months ago

arorashivoy commented 12 months ago

When I do command :LBQuestions I can only see 20 questions and not all the other questions.

image
csh0101 commented 11 months ago

the same question

csh0101 commented 11 months ago

I read the lua code. but i'm noob for lua .


local function display_questions(search_query)
    local graphql_endpoint = config.graphql_endpoint

    local variables = {
        limit = 20,
        filters = {
            difficulty = M.difficulty,
            searchKeywords = search_query,
            status = M.status,
        },
    }

    local query = [[
    query problemsetQuestionList($limit: Int, $filters: QuestionListFilterInput) {
  ]] .. (config.domain == "cn" and [[
      problemsetQuestionList(
  ]] or [[
      problemsetQuestionList: questionList(
  ]]) .. [[
        categorySlug: ""
        limit: $limit
        filters: $filters
    ) {
  ]] .. (config.domain == "cn" and [[
          total
          questions {
            paidOnly
            titleCn
            frontendQuestionId
  ]] or [[
          total: totalNum
          questions: data {
            paidOnly: isPaidOnly
            titleCn: title
            frontendQuestionId: questionFrontendId
  ]]) .. [[
            difficulty
            isFavor
            status
            titleSlug
        }
      }
    }
  ]]

limit 20 is a hard code for questions query.

in my situation, domain is "cn"..

so the graphql query is this.

query problemsetQuestionList($limit: Int, $filters: QuestionListFilterInput) {
  problemsetQuestionList(
    categorySlug: ""
    limit: $limit
    filters: $filters
  ) {
    total
    questions {
      paidOnly
      titleCn
      frontendQuestionId
      difficulty
      isFavor
      status
      titleSlug
    }
  }
}

at the moment, I find we can only find the 1-20 problem..

do you consider add page scroll for this? a configured page size for every page. maybe it's 20 '30 '50, and user can press shortcut to jump into next page or prev page? just a little suggessstion.

any way,the simple way for developer is let limit vars can be configured ..

csh0101 commented 11 months ago

fyi @arorashivoy @Dhanus3133

Dhanus3133 commented 11 months ago

You can check the README for the keymaps on the paginating problems in Telescope. Also, you can now increase the total number of problems displayed with limit in config, the default is 30 now.