-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Show PyPi link in requirements #23288
Show PyPi link in requirements #23288
Conversation
@microsoft-github-policy-service agree |
// Regex to allow to find every possible pypi package (base regex from https://peps.python.org/pep-0508/#names) | ||
const regex = /^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*)($|=| |;|\[)/i | ||
const row = document.lineAt(position.line).text; | ||
const projectName = row.match(regex); | ||
return(projectName) ? new Hover(`https://pypi.org/project/${projectName[1]}/`) : null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pull this out into a function by itself that takes in a string and returns hover info. Then you can test that function independently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this feature, and the test cases. This mostly looks good. I have some minor suggestions, overall looks great.
Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
@karthiknadig No, I think it's an issue in test:
|
There's still lint error on src/client/activation/requirementsTxtLinkActivator.ts |
@LouisGobert Sorry for another ping on this. Can you format the following with prettier extension? |
@karthiknadig Done: |
Show PyPi link in requirements, see microsoft#14495. Apart from the test to verify the register of `RequirementsTxtLinkActivator`, there are no other tests. This is my first contribution in TypeScript, if you have an example of a test that could be done, I'm interested :) --------- Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Show PyPi link in requirements, see #14495.
Apart from the test to verify the register of
RequirementsTxtLinkActivator
, there are no other tests. This is my first contribution in TypeScript, if you have an example of a test that could be done, I'm interested :)