coc-pretty-ts-errors
hexhcoc-pretty-ts-errors
Published Package Summary
coc-pretty-ts-errors
Inspired by https://github.com/yoavbls/pretty-ts-errors. This CoC extension is a port of the original extension to work with CoC.
Based on https://github.com/hexh250786313/pretty-ts-errors-markdown.
Features
-
Show TypeScript error messages in a more readable format.
-
You can choose to use
doHoveror diagnostic floating window to display error message by optionpretty-ts-errors.mode. -
There are two ways to highlight code blocks, one is to use the highlight group
PrettyTsErrorTypeto highlight a single color, and the other is to use ts syntax highlight.pretty-ts-errors.codeBlockHighlightTypescreenshot description "prettytserr"Use highlight group PrettyTsErrorTypeto highlight a single color."typescript"Use ts syntax highlight. And for correct syntax highlight it will extra add a "type Type = "before type definition in code blocks.※ Personally, I prefer to use
prettytserrto highlight a single color, because it is more readable and does not affect the original code.
Usage
Make sure you have coc.nvim and coc-tsserver installed.
And make sure your coc.nvim includes the pr https://github.com/neoclide/coc.nvim/commit/9c079ad79d66d4ede7886cc4094a822352559502 which gives diagnostic floating window highlight.
Then run the following command:
:CocInstall coc-pretty-ts-errors
Highlight Group
CocMarkdownCodeis for inline code.CocMarkdownLinkis for file link.PrettyTsErrorTypeis for the code block if you chooseprettytserrinpretty-ts-errors.codeBlockHighlightType.PrettyTsErrorTypedefaults link toCocMarkdownCode.
Q & A
-
Q: When to use
serverName -
A: Examples:
-
When using coc-tsserver ,
serverNameis"tsserver" -
When using a customized typescript
"languageserver", you need to modifyserverNameto the corresponding values, such as typescript-language-server// coc-settings.json "pretty-ts-errors.serverName": "my-tsserver", ~~~~~~~~~~~~~ Your customized typescript language server name. "languageserver": { "my-tsserver": { ~~~~~~~~~~~~~ `serverName` is from here. "enable": true, "command": "typescript-language-server", "args": ["--stdio"], ... ...other options } } -
Some common typescript language server names:
- coc-tsserver:
- repository: https://github.com/neoclide/coc-tsserver
"pretty-ts-errors.serverName": "tsserver",(Default)
- coc-volar:
- repository: https://github.com/yaegassy/coc-volar
- Options are same as coc-tsserver's ones. (coc-volar actually calls coc-tsserver)
- typescript-language-server:
- repository: https://github.com/typescript-language-server/typescript-language-server
"pretty-ts-errors.serverName": "xxxxxxxx",(It depends on your configuration)
- vtsls:
- repository: https://github.com/yioneko/vtsls
"pretty-ts-errors.serverName": "xxxxxxxx",(It depends on your configuration)
- coc-tsserver:
-
- coc-pretty-ts-errors
- onLanguage:javascript
- onLanguage:javascriptreact
- onLanguage:javascript.jsx
- onLanguage:typescript
- onLanguage:typescript.tsx
- onLanguage:typescript.jsx
- onLanguage:typescriptreact
- onLanguage:jsx-tags
- onLanguage:jsonc
- onLanguage:vue
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for coc-pretty-ts-errors@0.0.30.
This package does not declare any contributed commands.
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"enum": [
0,
1,
2
],
"type": "integer",
"default": 2,
"description": "Display mode of the error message.",
"markdownEnumDescriptions": [
"Diagnostic floating window",
"`:call CocActionAsync('doHover')` hover floating window",
"Both of diagnostic and doHover"
]
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable coc-pretty-ts-errors extension"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Show ref links in error message"
}Raw JSON Schema
{
"type": "string",
"default": "tsserver",
"description": "The name of the language server. Set it to 'tsserver' if youse coc-tsserver. Otherwise, set it to your customized typescript language server name."
}Raw JSON Schema
{
"enum": [
"prettytserr",
"typescript"
],
"type": "string",
"default": "prettytserr",
"description": "The way to highlight code block.",
"markdownEnumDescriptions": [
"Single color by `\"PrettyTsErrorType\"` highlight group",
"TS syntax highlight with extra `\"type Type =\"`"
]
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Experimental feature to filter original ts errors"
}