Skip to content

Commit

Permalink
fix: gifs not populating in vscode marketplace (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelangeloio authored Dec 17, 2023
1 parent 03c60ec commit 15a93d7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ TLDR; This is a *blazingly* fast **lsp server** to find *throw statements* in yo

### Check it out in action:

![demo](https://github.com/michaelangeloio/does-it-throw/blob/main/assets/basic-throw.gif)
![demo](./assets/basic-throw.gif)

Also supports **call expressions**:

![demo](https://github.com/michaelangeloio/does-it-throw/blob/main/assets/calltothrow.gif)
![demo](./assets/calltothrow.gif)


## Why?

Maybe you're working on a large codebase riddled with throw statements everywhere, and you want a better control flow. Or perhaps you're just curious about how many throw statements you have in your codebase. This simple tool can help you with that.

Untyped `throw` statements can be a pain for those who come from languages like Go, where errors are typically values and first class citizens. Even Rust has the `Result` type. Knowing where throw statements are in your codebase might be helpful, even if their return types aren't [directly supported](https://github.com/microsoft/TypeScript/issues/13219).
Untyped `throw` statements can be a pain for those who come from languages like Go, where errors are typically values and first-class citizens. Even Rust has the `Result` type. Knowing where throw statements are in your codebase might be helpful, even if their return types aren't [directly supported](https://github.com/microsoft/TypeScript/issues/13219).

> This extension may not be for everyone, but it's definitely for me. I hope you find it useful too.
Expand All @@ -39,7 +39,7 @@ Untyped `throw` statements can be a pain for those who come from languages like
| LSP Server | [NPM](https://www.npmjs.com/package/does-it-throw-lsp) |
| JetBrains | Coming soon... |

> This extension is built with security in mind. It doesn't send any data to any third party servers. All publishes are done via a signed immutable commit from the [CI pipeline](https://github.com/michaelangeloio/does-it-throw/blob/update-details/.github/workflows/release-please.yaml).
> This extension is built with security in mind. It doesn't send any data to any third party servers. All publishes are done via a signed immutable commit from the [CI pipeline](https://github.com/michaelangeloio/does-it-throw/actions/workflows/release-vsix.yaml).
> The core of the code is written in Rust, and the LSP implementation for VsCode is written in Typescript. The Rust code is compiled to WASM and bundled with the VsCode extension. The extension is published to the VsCode marketplace, and the Rust code is published to [crates.io](https://crates.io/crates/does-it-throw).
Expand Down
26 changes: 25 additions & 1 deletion build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,28 @@ const compile = async ({
}
}

const copyREADME = async () => {
const [readMe, license] = await Promise.all([
await Bun.file('README.md').text(),
await Bun.file('LICENSE.txt').text()
])
const baseUrl = 'https://github.com/michaelangeloio/does-it-throw/blob/main'
function replaceLinks(markdown: string, prefix: string) {
const regex = /!\[.*?\]\((\.\/assets\/(basic-throw|calltothrow).*?)\)/g
return markdown.replace(regex, (match, p1) => {
return match.replace(p1, prefix + p1.substring(1))
})
}
const newReadMe = replaceLinks(readMe, baseUrl)
log('writing new readme')
await Promise.all([Bun.write('server/README.md', newReadMe), Bun.write('server/LICENSE.txt', license)])
return {
isError: false,
error: null,
type: 'copy-readme'
}
}

/**
* Build everything in parallel after wasm
*/
Expand All @@ -164,7 +186,9 @@ const compile = async ({
}
}

errors.push(...(await Promise.all([compileClient(), compileServer(), typeCheck('server'), typeCheck('client')])))
errors.push(
...(await Promise.all([compileClient(), compileServer(), typeCheck('server'), typeCheck('client'), copyREADME()]))
)
return errors
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"vscode:release": "vsce publish",
"vscode:package": "vsce package",
"format": "biome format .",
"pack:server": "cp README.md server/README.md && cp LICENSE.txt server/LICENSE.txt && npm pack --workspace server",
"pack:server": "npm pack --workspace server",
"publish:server": "npm publish --workspace server"
},
"types": "index.d.ts",
Expand Down

0 comments on commit 15a93d7

Please sign in to comment.