Closed andyli386 closed 1 year ago
The implementation till now I made was focused on global but yet I haven't yet completely added the support for "cn". The support for the "cn" domain is on my radar, and I will be looking into it soon to make fully compatible with the Chinese Leetcode platform.
Many thanks
Hey @andyli386, The plugin now supports the cn
version of Leetcode. If you encounter any issues or have suggestions, please let me know. Thanks.
I can use this plugin when setting up the COM version, but the CN version doesn't work.
you can change questions.lua file two points:
one:(modify)
local function filter_problems() -- local cancel = function() end return function(prompt) if config.domain == "cn" then return display_questions_cn(prompt) else return display_questions(prompt) end end end
two:(add function)
local function display_questions_cn(search_query) local graphql_endpoint = config.graphql_endpoint
local variables = {
categorySlug = "",
limit = 40,
skip = 0,
filters = {
difficulty = M.difficulty,
searchKeywords = search_query,
status = M.status,
}
}
local query = [[
query problemsetQuestionList($categorySlug: String, $limit: Int, $skip: Int, $filters: QuestionListFilterInput) {
problemsetQuestionList(
categorySlug: $categorySlug
limit: $limit
skip: $skip
filters: $filters) {
hasMore
total
questions {
acRate
difficulty
freqBar
frontendQuestionId
isFavor
paidOnly
solutionNum
status
title
titleCn
titleSlug
topicTags {
name
nameTranslated
id
slug
}
extra {
hasVideoSolution
topCompanyTags {
imgUrl
slug
numSubscribed
}
}
}
}
}
]]
local response =
curl.post(graphql_endpoint,
{
headers = headers,
body = vim.json.encode({ operationName = "problemsetQuestionList", query = query, variables = variables })
})
--print(response["body"])
local data = vim.json.decode(response["body"])["data"]["problemsetQuestionList"]
return (data ~= vim.NIL and data["questions"] or {})
end
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,
} just add 'domain="cn"', I can login with my account but cannot find any questions when I uselq command.