mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 22:54:42 +00:00
[playground] Allow selecting the diagnostic message (#17051)
## Summary Allow selecting the diagnostic message so that the message can be copied (e.g. into an issue) ## Test Plan <img width="1679" alt="Screenshot 2025-03-28 at 16 52 45" src="https://github.com/user-attachments/assets/06674d87-6c88-45d4-b46c-0bcb3e151996" />
This commit is contained in:
parent
98438a77f2
commit
37a40e30f6
2 changed files with 3 additions and 2 deletions
|
@ -84,7 +84,7 @@ function Items({
|
||||||
<li key={`${diagnostic.text_range()?.start ?? 0}-${id ?? index}`}>
|
<li key={`${diagnostic.text_range()?.start ?? 0}-${id ?? index}`}>
|
||||||
<button
|
<button
|
||||||
onClick={() => onGoTo(startLine, startColumn)}
|
onClick={() => onGoTo(startLine, startColumn)}
|
||||||
className="w-full text-start cursor-pointer"
|
className="w-full text-start cursor-pointer select-text"
|
||||||
>
|
>
|
||||||
{diagnostic.message()}
|
{diagnostic.message()}
|
||||||
<span className="text-gray-500">
|
<span className="text-gray-500">
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useMemo } from "react";
|
||||||
interface Props {
|
interface Props {
|
||||||
diagnostics: Diagnostic[];
|
diagnostics: Diagnostic[];
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
|
|
||||||
onGoTo(line: number, column: number): void;
|
onGoTo(line: number, column: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ function Items({
|
||||||
diagnostic.start_location.column,
|
diagnostic.start_location.column,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
className="w-full text-start"
|
className="w-full text-start cursor-pointer select-text"
|
||||||
>
|
>
|
||||||
{diagnostic.message}{" "}
|
{diagnostic.message}{" "}
|
||||||
<span className="text-gray-500">
|
<span className="text-gray-500">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue