raphaelheinz / LeetHub-3.0

This plugin automatically pushes your code to GitHub when you pass all tests on a Leetcode problem.
MIT License
113 stars 74 forks source link

Language not found for Pandas exercises #12

Closed Adrien-LUDWIG closed 9 months ago

Adrien-LUDWIG commented 9 months ago

Describe the bug

When I submit Pandas exercises, the error Could not find language is thrown.

I tried simply adding it to the list of languages here:

https://github.com/raphaelheinz/LeetHub-3.0/blob/1c3af36893a8d8f7509fba2007badf664c193a18/scripts/leetcode.js#L1-L26

but, for some reason I wasn't able to pinpoint, this is not taken into account.

Adding Pandas to the list of languages directly into getLanguageExtension did the trick. Here, just before the return:

https://github.com/raphaelheinz/LeetHub-3.0/blob/1c3af36893a8d8f7509fba2007badf664c193a18/scripts/leetcode.js#L716-L719

To Reproduce Steps to reproduce the behavior:

  1. Submit a working Pandas exercise.

For example, the exercise modifySalaryColumn with code:

import pandas as pd

def modifySalaryColumn(employees: pd.DataFrame) -> pd.DataFrame:
    employees.salary *= 2
    return employees

Expected behavior

Pandas exercises should be recognized as Python code, so with extension .py.

Additional context

Tested using Dynamic layout (because I was not able to make LeetHub-V3.0 work at all in Split View layout).

raphaelheinz commented 9 months ago

Hi @Adrien-LUDWIG,

thanks for reporting this bug. I was able to solve this issue by adding 'Pandas' to the supported languages. Please check my related commit: https://github.com/raphaelheinz/LeetHub-3.0/commit/274e132afc9818a43403b060a566f55c74cccfd8

Could you please test again if it works for you?

Adrien-LUDWIG commented 9 months ago

That's the first thing I tried but "Pandas" did not appear as a key of languages when I added a consol.log(). I'm not an expert in JavaScript. Could it be that the languages variable is not redefined when I modify it directly in my browser?

raphaelheinz commented 9 months ago

OK no problem. Maybe there are caching problems or your new values are overwritten because the script is reloaded again...

I would propose that I merge my commit into master and update the plugin in Chrome Webstore to v0.0.6. After getting approved by Google (1-2 days) you could test if this issue is solved. Please give me feedback then :)

raphaelheinz commented 9 months ago

I am closing this topic as this issue has been resolved with v0.0.6. Feel free to reopen if the problems persists :)