Title: Properly highlight docstrings by wmvanvliet · Pull Request #83 · vim-python/python-syntax · GitHub
Open Graph Title: Properly highlight docstrings by wmvanvliet · Pull Request #83 · vim-python/python-syntax
X Title: Properly highlight docstrings by wmvanvliet · Pull Request #83 · vim-python/python-syntax
Description: Another attempt at #45 and #57, namely to properly highlight docstrings as comments. For now, this implementation is very ugly, but it actually works. It only highlights things that should be docstrings without touching other types of multiline strings. This is accomplished by checking for : characters and combining that with nextgroup=pythonDocString to interpret the first directly following multiline string as a docstring. Another case is added for the first multiline string appearing at the top of the file. See https://gist.github.com/wmvanvliet/36471bb456151d93b86c402b64684b0a for a bunch of challenging test cases. The implementation is messy right now to work around a specific problem. Any pointers on how to solve this more elegantly are greatly appreciated. The problem is that nextgroup=pythonDocString skipempty will skip newlines, but not spaces in its search for the docstring, and so it will only find it when the docstring starts on the first column of a line. For now, the workaround is to match +^\s*"""+ as a docstring, i.e. also match the leading whitespace, but this causes the docstring rule to have precedence over the normal +"""+ multiline pattern. Ideally, the multiline rule should take precedence and have this precedence temporarily overwritten by the presence of a : mark.
Open Graph Description: Another attempt at #45 and #57, namely to properly highlight docstrings as comments. For now, this implementation is very ugly, but it actually works. It only highlights things that should be docst...
X Description: Another attempt at #45 and #57, namely to properly highlight docstrings as comments. For now, this implementation is very ugly, but it actually works. It only highlights things that should be docst...
Opengraph URL: https://github.com/vim-python/python-syntax/pull/83
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:be7fe2e6-7bd3-6908-8a1d-95fc6875a1ad |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 9176:2B9476:45105F:5D23C4:6979F744 |
| html-safe-nonce | 3bf60f326b12fcd92b9bcbb8391ef1e21b201e26efad3c536c94a88e4ed6e367 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTc2OjJCOTQ3Njo0NTEwNUY6NUQyM0M0OjY5NzlGNzQ0IiwidmlzaXRvcl9pZCI6IjgzODkzMTUwMzA2OTU5MzM3NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 66c9f9ccc816c29df5ba659f0d63fb4d7d30acdaa873efee56422a166b6779d3 |
| hovercard-subject-tag | pull_request:614361199 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/vim-python/python-syntax/pull/83/checks |
| twitter:image | https://avatars.githubusercontent.com/u/428273?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/428273?s=400&v=4 |
| og:image:alt | Another attempt at #45 and #57, namely to properly highlight docstrings as comments. For now, this implementation is very ugly, but it actually works. It only highlights things that should be docst... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d518616844426fb176f4177c4776349f6e70ef1ce75f459c8c53bf9293bb6982 |
| turbo-cache-control | no-preview |
| go-import | github.com/vim-python/python-syntax git https://github.com/vim-python/python-syntax.git |
| octolytics-dimension-user_id | 25825542 |
| octolytics-dimension-user_login | vim-python |
| octolytics-dimension-repository_id | 82203847 |
| octolytics-dimension-repository_nwo | vim-python/python-syntax |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 82203847 |
| octolytics-dimension-repository_network_root_nwo | vim-python/python-syntax |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 22c6ce7724007ae85d7487fce3308a1c7cea8be6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width