feat(lsp): complete closing triple-quoted strings - #4737
mangeshraut712 wants to merge 3 commits into
Conversation
|
Hi @mangeshraut712! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
e7b7748 to
55ebe4a
Compare
|
This pull request has been imported. If you are a Meta employee, you can view this in D119010817. (Because this pull request was imported automatically, there will not be any future comments.) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3bb0928 to
dd4e429
Compare
Offer a snippet (or plain text) completion that expands a 1–2 quote run into a triple-quoted pair, or inserts the closer after an opening """. Matches the ty completion request in facebook#4346.
A one- or two-quote run is already an open string, so expanding it into a triple-quoted snippet stole Literal, dict-key, and kwarg completions. Offer the closer only after """ / '''.
dd4e429 to
cff85b2
Compare
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Summary
Fixes #4346
When the cursor is immediately after one, two, or three
"/'quotes, offer a completion that turns them into a closed triple-quoted string (the ty behavior)."""…"""(snippet$0between the pair when the client supports snippets).$0"""with snippets)."""/'''.foo"), but still fire after string prefixes (f""",r""", …).AI usage: an assistant drafted the completion helper and tests; I reviewed the LSP edit ranges, prefix handling, and test cursors.
Test Plan
All five new tests passed.