Skip to content

Commit

Permalink
Readme.md additions and package versions bump (#70)
Browse files Browse the repository at this point in the history
* Readme additions

* Change alt

* Bump package versions

* Prettify the whole project
  • Loading branch information
yoavbls authored Jul 29, 2023
1 parent 27056da commit 995f288
Show file tree
Hide file tree
Showing 8 changed files with 1,283 additions and 1,194 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
node_modules
.vscode-test/
*.vsix
.idea
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@

<b>Make TypeScript errors prettier and human-readable in VSCode.</b>

[![Visual Studio Code](https://img.shields.io/badge/--007ACC?logo=visual%20studio%20code&logoColor=ffffff)](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors)&nbsp;[![GitHub license](https://badgen.net/github/license/yoavbls/pretty-ts-errors)](https://github.com/yoavbls/pretty-ts-errors/blob/main/LICENSE)&nbsp;![visitor badge](https://visitor-badge.glitch.me/badge?page_id=pretty-ts-errors)
[![GitHub stars](https://img.shields.io/github/stars/yoavbls/pretty-ts-errors.svg?style=social&label=Star)](https://github.com/yoavbls/pretty-ts-errors/stargazers/)

<a href="https://github.com/yoavbls/pretty-ts-errors/discussions/43"><img src="https://raw.githubusercontent.com/yoavbls/pretty-ts-errors/assets/assets/mentions/vote.png" width="490px" /></a>
[![Visual Studio Code](https://img.shields.io/badge/--007ACC?logo=visual%20studio%20code&logoColor=ffffff)](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors)&nbsp;[![GitHub license](https://badgen.net/github/license/yoavbls/pretty-ts-errors)](https://github.com/yoavbls/pretty-ts-errors/blob/main/LICENSE)&nbsp;[![Visual Studio Code](https://img.shields.io/visual-studio-marketplace/i/yoavbls.pretty-ts-errors)](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors)
<a href="https://github.com/yoavbls/pretty-ts-errors/discussions/43#user-content-jetbrains-support"><img src="https://cdn.icon-icons.com/icons2/2530/PNG/512/jetbrains_webstorm_button_icon_151873.png" height="20" alt="Webstorm logo"></a>

TypeScript errors become messier as the complexity of types increases. At some point, TypeScript will throw on you a shitty heap of parentheses and `"..."`.
This extension will help you understand what's going on. For example, in this relatively simple error:
Expand All @@ -26,6 +25,13 @@ This extension will help you understand what's going on. For example, in this re
<img src="https://raw.githubusercontent.com/yoavbls/pretty-ts-errors/assets/assets/mentions/theo-video.png" alt="Watch theo's video" width="600" />
</a>

and others from:
[Web Dev Simplified](https://www.youtube.com/watch?v=ccg-erZYO4k&list=PL0rc4JAdEsVpOriHzlAG7KUnhKIK9c7OR&index=1),
[Josh tried coding](https://www.youtube.com/watch?v=_9y29Cyo9uU&list=PL0rc4JAdEsVpOriHzlAG7KUnhKIK9c7OR&index=3),
[trash dev](https://www.youtube.com/watch?v=WJeD3DKlWT4&list=PL0rc4JAdEsVpOriHzlAG7KUnhKIK9c7OR&index=4&t=208),
and [more](https://www.youtube.com/playlist?list=PL0rc4JAdEsVpOriHzlAG7KUnhKIK9c7OR)


## Features
- Syntax highlighting with your theme colors for types in error messages, supporting both light and dark themes
- A button that leads you to the relevant type declaration next to the type in the error message
Expand Down
2,335 changes: 1,208 additions & 1,127 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Pretty TypeScript Errors",
"publisher": "yoavbls",
"description": "Make TypeScript errors prettier and more human-readable in VSCode",
"version": "0.4.1",
"version": "0.5.0",
"icon": "assets/icon.png",
"repository": {
"type": "git",
Expand Down Expand Up @@ -64,24 +64,24 @@
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^7.2.0",
"@types/lz-string": "^1.3.34",
"@types/mocha": "^9.1.1",
"@types/glob": "^8.1.0",
"@types/lz-string": "^1.5.0",
"@types/mocha": "^10.0.1",
"@types/node": "16.x",
"@types/prettier": "^2.7.2",
"@types/prettier": "^2.7.3",
"@types/vscode": "^1.70.0",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"@vscode/test-electron": "^2.1.5",
"esbuild": "^0.17.16",
"eslint": "^8.20.0",
"glob": "^8.0.3",
"mocha": "^10.0.0",
"typescript": "^5.0.4"
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@vscode/test-electron": "^2.3.3",
"esbuild": "^0.18.17",
"eslint": "^8.46.0",
"glob": "^10.3.3",
"mocha": "^10.2.0",
"typescript": "^5.1.6"
},
"dependencies": {
"lz-string": "^1.4.4",
"prettier": "^2.8.7",
"lz-string": "^1.5.0",
"prettier": "^2.8.8",
"ts-dedent": "^2.2.0",
"vscode-languageclient": "^8.1.0",
"vscode-languageserver-types": "^3.17.3",
Expand Down
2 changes: 1 addition & 1 deletion src/components/unStyledCodeBlock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inlineCodeBlock, multiLineCodeBlock } from "./codeBlock";
import {d} from "../utils";
import { d } from "../utils";

/**
* Code block without syntax highlighting like.
Expand Down
5 changes: 3 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function activate(context: ExtensionContext) {
diagnostic.source
? has(["ts", "deno-ts", "js"], diagnostic.source)
: false
).forEach(async (diagnostic) => {
)
.forEach(async (diagnostic) => {
// formatDiagnostic converts message based on LSP Diagnostic type, not VSCode Diagnostic type, so it can be used in other IDEs.
// Here we convert VSCode Diagnostic to LSP Diagnostic to make formatDiagnostic recognize it.
let formattedMessage = cache.get(diagnostic.message);
Expand All @@ -62,7 +63,7 @@ export function activate(context: ExtensionContext) {

items.push({
range: diagnostic.range,
contents: [formattedMessage]
contents: [formattedMessage],
});

hasTsDiagnostic = true;
Expand Down
30 changes: 15 additions & 15 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import * as path from 'path';
import * as path from "path";

import { runTests } from '@vscode/test-electron';
import { runTests } from "@vscode/test-electron";

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../../");

// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index');
// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, "./suite/index");

// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error('Failed to run tests');
process.exit(1);
}
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error("Failed to run tests");
process.exit(1);
}
}

main();
62 changes: 31 additions & 31 deletions src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import * as path from 'path';
import * as Mocha from 'mocha';
import * as glob from 'glob';
import * as path from "path";
import * as Mocha from "mocha";
import * as glob from "glob";

export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
color: true
});
// Create the mocha test
const mocha = new Mocha({
ui: "tdd",
color: true,
});

const testsRoot = path.resolve(__dirname, '..');
const testsRoot = path.resolve(__dirname, "..");

return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}
return new Promise((c, e) => {
glob("**/**.test.js", { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}

// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));

try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
console.error(err);
e(err);
}
});
});
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
console.error(err);
e(err);
}
});
});
}

0 comments on commit 995f288

Please sign in to comment.