mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:14:52 +00:00
[ty] Use …
as the "cut" indicator in diagnostic rendering (#19420)
This makes ty match ruff's behavior. Specifically, we want to use `…` instead of the default `...` because `...` has special significance in Python.
This commit is contained in:
parent
39b41838f3
commit
ba7ed3a6f9
4 changed files with 7 additions and 6 deletions
|
@ -158,7 +158,8 @@ impl std::fmt::Display for DisplayDiagnostics<'_> {
|
||||||
AnnotateRenderer::styled()
|
AnnotateRenderer::styled()
|
||||||
} else {
|
} else {
|
||||||
AnnotateRenderer::plain()
|
AnnotateRenderer::plain()
|
||||||
};
|
}
|
||||||
|
.cut_indicator("…");
|
||||||
|
|
||||||
renderer = renderer
|
renderer = renderer
|
||||||
.error(stylesheet.error)
|
.error(stylesheet.error)
|
||||||
|
|
|
@ -660,7 +660,7 @@ fn can_handle_large_binop_expressions() -> anyhow::Result<()> {
|
||||||
--> test.py:4:13
|
--> test.py:4:13
|
||||||
|
|
|
|
||||||
2 | from typing_extensions import reveal_type
|
2 | from typing_extensions import reveal_type
|
||||||
3 | total = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1...
|
3 | total = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +…
|
||||||
4 | reveal_type(total)
|
4 | reveal_type(total)
|
||||||
| ^^^^^ `Literal[2000]`
|
| ^^^^^ `Literal[2000]`
|
||||||
|
|
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ error[invalid-syntax]
|
||||||
--> src/mdtest_snippet.py:6:19
|
--> src/mdtest_snippet.py:6:19
|
||||||
|
|
|
|
||||||
4 | async def f():
|
4 | async def f():
|
||||||
5 | # error: 19 [invalid-syntax] "cannot use an asynchronous comprehension inside of a synchronous comprehension on Python 3.10 (synt...
|
5 | # error: 19 [invalid-syntax] "cannot use an asynchronous comprehension inside of a synchronous comprehension on Python 3.10 (syntax…
|
||||||
6 | return {n: [x async for x in elements(n)] for n in range(3)}
|
6 | return {n: [x async for x in elements(n)] for n in range(3)}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use an asynchronous comprehension inside of a synchronous comprehension on Python 3.10 (syntax was added in 3.11)
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use an asynchronous comprehension inside of a synchronous comprehension on Python 3.10 (syntax was added in 3.11)
|
||||||
7 | async def test():
|
7 | async def test():
|
||||||
|
|
|
@ -41,7 +41,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/with/sync.md
|
||||||
error[invalid-context-manager]: Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and `__exit__`
|
error[invalid-context-manager]: Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and `__exit__`
|
||||||
--> src/mdtest_snippet.py:6:6
|
--> src/mdtest_snippet.py:6:6
|
||||||
|
|
|
|
||||||
5 | # error: [invalid-context-manager] "Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and...
|
5 | # error: [invalid-context-manager] "Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and `…
|
||||||
6 | with Manager():
|
6 | with Manager():
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
7 | ...
|
7 | ...
|
||||||
|
@ -57,7 +57,7 @@ info: rule `invalid-context-manager` is enabled by default
|
||||||
error[invalid-context-manager]: Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and `__exit__`
|
error[invalid-context-manager]: Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and `__exit__`
|
||||||
--> src/mdtest_snippet.py:13:6
|
--> src/mdtest_snippet.py:13:6
|
||||||
|
|
|
|
||||||
12 | # error: [invalid-context-manager] "Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` an...
|
12 | # error: [invalid-context-manager] "Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and …
|
||||||
13 | with Manager():
|
13 | with Manager():
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
14 | ...
|
14 | ...
|
||||||
|
@ -73,7 +73,7 @@ info: rule `invalid-context-manager` is enabled by default
|
||||||
error[invalid-context-manager]: Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and `__exit__`
|
error[invalid-context-manager]: Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and `__exit__`
|
||||||
--> src/mdtest_snippet.py:20:6
|
--> src/mdtest_snippet.py:20:6
|
||||||
|
|
|
|
||||||
19 | # error: [invalid-context-manager] "Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` an...
|
19 | # error: [invalid-context-manager] "Object of type `Manager` cannot be used with `with` because it does not implement `__enter__` and …
|
||||||
20 | with Manager():
|
20 | with Manager():
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
21 | ...
|
21 | ...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue