Skip to content
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

Signature provider for Jedi can fail with Unterminated group while building regex #16090

Closed
gramster opened this issue Apr 29, 2021 · 2 comments
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug good first issue verified Verification succeeded

Comments

@gramster
Copy link
Member

2021.4.765268190
plaforms {'win32', 'darwin', 'linux'}

        SyntaxError: Invalid regular expression: /\s*:<REDACTED: user-file-path>*(a1:\s*([^\n, ]+)/: Unterminated group
                at new RegExp (<anonymous>)
                at /out/client/extension.js:59:3685
                at Array.forEach (<anonymous>)
                at /out/client/extension.js:59:3617
                at /out/client/extension.js:59:3848
                at Array.map (<anonymous>)
                at /out/client/extension.js:59:3495
                at Array.forEach (<anonymous>)
                at Function.parseData (/out/client/extension.js:59:3056)
                at /out/client/extension.js:59:4340
                at runMicrotasks (<anonymous>)
                at processTicksAndRejections (<REDACTED: user-file-path>:97:5)
@gramster gramster added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team labels Apr 29, 2021
@karthiknadig
Copy link
Member

karthiknadig commented Apr 29, 2021

This is in old Jedi:

const DOCSTRING_PARAM_PATTERNS = [
'\\s*:type\\s*PARAMNAME:\\s*([^\\n, ]+)', // Sphinx
'\\s*:param\\s*(\\w?)\\s*PARAMNAME:[^\\n]+', // Sphinx param with type
'\\s*@type\\s*PARAMNAME:\\s*([^\\n, ]+)', // Epydoc
];

There is potential for this line to introduce errors in the regex:

pattern = pattern.replace('PARAMNAME', paramName);

We should catch the parsing error and just ignore it. This occurs while trying to extract parameter info, and if this fails it won't matter much. The text from the docs should still be visible to the user.

@karthiknadig karthiknadig added area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. needs PR good first issue and removed triage-needed Needs assignment to the proper sub-team labels Apr 29, 2021
@karthiknadig karthiknadig changed the title Improper escaping during construction of regular expression Signature provider for Jedi can fail with Unterminated group while building regex Apr 29, 2021
@kimadeline
Copy link

We use Jedi behind LSP now, we don't do any parsing anymore (#11995, #17225). Closing as stale.

@kimadeline kimadeline added this to the September 2021 milestone Sep 21, 2021
@kimadeline kimadeline added the verified Verification succeeded label Sep 21, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug good first issue verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants