-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add docs for the custom CSS hack * Bump version
- Loading branch information
Showing
4 changed files
with
75 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
To hide the original errors, display only the prettified ones, and make type blocks copyable, you can use the following hack: | ||
|
||
## The Hack | ||
|
||
1. Install the [Custom CSS and JS Loader](https://marketplace.visualstudio.com/items?itemName=be5invis.vscode-custom-css) extension from the VSCode marketplace. | ||
|
||
2. Follow the installation instructions provided by the extension, and use [this CSS file](./pretty-ts-errors-hack.css). | ||
|
||
## Why Do We Need This Hack? | ||
|
||
### Hiding Original Errors | ||
|
||
Unfortunately, VSCode doesn't currently support formatted diagnostics. Once it does, we'll be able to convert the extension to a TypeScript LSP Plugin that replaces the original error with the prettified version. | ||
For updates on this feature, follow [this issue](https://github.com/yoavbls/pretty-ts-errors/issues/3). | ||
|
||
### Making Type Blocks Copyable | ||
|
||
VSCode sanitizes and removes most CSS properties for security reasons. We've opened an [issue](https://github.com/microsoft/vscode/issues/180496) and submitted a [PR](https://github.com/microsoft/vscode/pull/180498) to allow the use of the `display` property. This would enable us to layout the types in a way that allows copying. | ||
|
||
Until this change is approved, you can use the hack described above as a workaround. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Allow copying */ | ||
.codicon-none { | ||
user-select: text !important; | ||
-webkit-user-select: text !important; | ||
} | ||
|
||
/* Hide errors */ | ||
div.monaco-hover-content:has(.codicon-none) > .hover-row:first-child { | ||
display: none !important; | ||
} | ||
div.monaco-hover-content:has([style="color:#f96363;"]) > .hover-row:first-child { | ||
display: none !important | ||
} | ||
|
||
/* Change order */ | ||
.monaco-hover .monaco-hover-content { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.monaco-hover .monaco-hover-content .hover-row { | ||
order: 2; | ||
} | ||
.monaco-hover .monaco-hover-content .hover-row:has(.codicon-none) { | ||
order: 1; | ||
} | ||
.monaco-hover .monaco-hover-content .hover-row:has([style="color:#f96363;"]) { | ||
order: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters