Skip to content

How can i debug my code #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
loisjee opened this issue Mar 29, 2019 · 6 comments
Closed

How can i debug my code #244

loisjee opened this issue Mar 29, 2019 · 6 comments

Comments

@loisjee
Copy link

loisjee commented Mar 29, 2019

Hello! I want to know how can i debug my code after i finish my solution in vscode. can anybody help me

@jdneo
Copy link
Member

jdneo commented Mar 29, 2019

Hi @songjee,

Debug is not supported yet. If you want to debug your solution, you need to install related language extensions and write some code to wrap your solution.

@littlebeandog
Copy link

I dont think this is a concern of this extension though.....

@Vigilans
Copy link
Contributor

Vigilans commented Mar 30, 2019

If you write your solution in cpp, you could take a look at the discussion in #241.

This feature is currently under early discussion, and is a concern of mine.

@Luanf
Copy link

Luanf commented Mar 31, 2019

Just wanted to add that my approach has been using the CodeRunner extension: https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner

I then add a call to the solution function, like so:

// Pre generated template
solution(...) {
    ...
}
// I add this line so running CodeRunner executes the function
solution()

Of course you can then add inputs to it:

a = 'foo'
b = 'bar'
solution(a, b)

Depending on the problem.

@BrambleXu
Copy link

BrambleXu commented Mar 31, 2019

You can write test cases by yourself. Here is mine.

if __name__ == "__main__":
    s = Solution()
    testcases = [
                 ("USA", True), 
                 ("leetcode", True),
                 ("Facebook", True),
                 ("HaWa", False),
                 ]
    for i, (inp, ans) in enumerate(testcases):
        print("Test case: ", i)
        print("answer:   ", s.detectCapitalUse(inp))
        print("expected: ", ans)
        print()

As @littlebeandog said, the test is not a concern for this extension. This should be closed.

@jdneo
Copy link
Member

jdneo commented Mar 31, 2019

Thank you @ALL for providing the solutions.

I'm closing the issue for now, but the discussion is still open!

For anyone who has his own solution about debugging the code, please feel free to comment.

You can also add 👍 for your favorite solution, which could be a guide for those who need help.

@jdneo jdneo closed this as completed Mar 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants