Files
oak-gpui/crates
ClanEverandMarshall Bowers 188a893fd0 python: Enhance syntax highlighting for type hints (#18185)
Release Notes:

- Python: Improved syntax highlighting for type hints.

# Before

![image](https://github.com/user-attachments/assets/876a69ab-a572-4d1b-af99-e6f85f249ea6)

# After

![image](https://github.com/user-attachments/assets/4fb98a9b-bc5d-4799-b535-057047884383)

---
Why manual recursion?
- Due to tree-sitter grammar not supporting recursion in query
(https://github.com/tree-sitter-grammars/tree-sitter-lua/issues/24),
currently only manual recursion is possible (refer to
https://github.com/projekt0n/github-nvim-theme/pull/250/files).

<br/>

Unable to highlight when simple structures appear before complex
structures, example:
```python
def t() -> str | dict[int, dict[int, dict[int, str]]]:
    pass
```
Because complex structures are parsed as `subscript` rather than
`generic_type` by tree-sitter in this case ☹

<br/>

Related:

- https://github.com/zed-industries/zed/issues/14715
- [Union Type (Python
Doc)](https://docs.python.org/3/library/stdtypes.html#union-type)
- [Type parameter lists (Python
Doc)](https://docs.python.org/3/reference/compound_stmts.html#type-parameter-lists)

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-10-28 16:56:59 -04:00
..
2024-10-24 12:14:03 -06:00
2024-10-27 19:44:21 -07:00
2024-10-24 12:14:03 -06:00
2024-10-24 12:14:03 -06:00
2024-09-13 13:17:49 -04:00
2024-08-13 23:06:07 -07:00
2024-10-28 15:34:03 +01:00
2024-10-26 03:32:22 +03:00
2024-07-15 17:04:15 -06:00
2024-10-21 13:05:30 +03:00
2024-10-21 13:05:30 +03:00
2024-10-02 13:27:16 +02:00
2024-10-23 00:14:43 -07:00
2024-10-28 15:34:03 +01:00