Skip to content

Commit

Permalink
feat: neovim support (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelangeloio authored Dec 16, 2023
1 parent 41b64ca commit 6152786
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 34 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release NPM

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Prepare repository
run: git fetch --unshallow --tags

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

- name: Install Bun
uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Install wasm-pack
uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa
with:
version: 'latest'

- name: Install dependencies
run: bun install

- name: Build Language Server
run: bun run build

- name: Package Language Server
run: bun run pack:server

- name: Publish Language Server
run: bun run publish:server
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_LSP_SERVER_TOKEN }}
7 changes: 6 additions & 1 deletion .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.VSIX_DISPATCH_TOKEN }}


- name: Trigger NPM Publish Release
if: ${{ steps.release.outputs.release_created }}
run: gh workflow run release-npm.yaml
env:
GITHUB_TOKEN: ${{ secrets.NPM_DISPATCH_TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/
.DS_Store

.env
*.tgz
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"crates/does-it-throw": "0.1.11",
"crates/does-it-throw-wasm": "0.1.11",
".": "0.2.5"
".": "0.2.5",
"server": "0.2.5"
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source.fixAll.eslint": "explicit"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
"editor.defaultFormatter": "vscode.json-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<p align="center">
<img src ="https://github.com/michaelangeloio/does-it-throw/blob/main/assets/icon-small.png?raw=true" width='400'>
<img src ="https://github.com/michaelangeloio/does-it-throw/blob/main/assets/icon-small.png?raw=true" width='350'>
</p>

<p align="center">
<img src="https://github.com/michaelangeloio/does-it-throw/actions/workflows/rust.yaml/badge.svg" alt="Rust Build Status">
<img src="https://github.com/michaelangeloio/does-it-throw/actions/workflows/ts.yaml/badge.svg" alt="TypeScript Build Status">
</p>

# Well, Does it Throw?

Expand All @@ -10,11 +14,11 @@ TLDR; This is a *blazingly* fast **lsp server** to find *throw statements* in yo

### Check it out in action:

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

Also supports **call expressions**:

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


## Why?
Expand Down Expand Up @@ -51,7 +55,7 @@ Untyped `throw` statements can be a pain for those who come from languages like
Contributions are certainly welcome! Please open an issue or submit a PR. If you find a use case that isn't supported yet, please search the open issues and open a new one if it doesn't exist.

### Dev Setup
Everything can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file!
Everything can be found in the [CONTRIBUTING.md](https://github.com/michaelangeloio/does-it-throw/blob/main/CONTRIBUTING.md) file!

## Feedback & Suggestions
Please use the GitHub discussions tab to provide feedback and suggestions. Thanks!
Expand All @@ -62,4 +66,4 @@ Please use the GitHub discussions tab to provide feedback and suggestions. Thank
- [Oso Vscode Extension](https://github.com/osohq/oso) - For the WASM inspiration. Excellent article [here](https://www.osohq.com/post/building-vs-code-extension-with-rust-wasm-typescript).

## License
MIT - See [LICENSE](./LICENSE) for more information.
MIT - See [LICENSE](https://github.com/michaelangeloio/does-it-throw/blob/main/LICENSE.txt) for more information.
Binary file modified bun.lockb
Binary file not shown.
7 changes: 5 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "vscode-does-it-throw-client",
"description": "VSCode part of a language server",
"author": "Microsoft Corporation",
"description": "VSCode Client for the Does It Throw extension",
"author": {
"name": "Michael Angelo",
"email": "[email protected]"
},
"license": "MIT",
"version": "0.1.6",
"publisher": "vscode",
Expand Down
15 changes: 9 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 49 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@
"name": "Michael Angelo",
"email": "[email protected]"
},
"categories": ["Programming Languages", "Linters", "Debuggers"],
"keywords": ["does it throw", "throw finder", "throw", "javascript", "typescript"],
"categories": [
"Programming Languages",
"Linters",
"Debuggers"
],
"keywords": [
"does it throw",
"throw finder",
"throw",
"javascript",
"typescript"
],
"galleryBanner": {
"color": "#050b1f",
"theme": "dark"
Expand Down Expand Up @@ -66,28 +76,48 @@
"doesItThrow.throwStatementSeverity": {
"scope": "resource",
"type": "string",
"enum": ["Error", "Warning", "Information", "Hint"],
"enum": [
"Error",
"Warning",
"Information",
"Hint"
],
"default": "Hint",
"description": "Controls the severity level (underline) of a throw statement."
},
"doesItThrow.functionThrowSeverity": {
"scope": "resource",
"type": "string",
"enum": ["Error", "Warning", "Information", "Hint"],
"enum": [
"Error",
"Warning",
"Information",
"Hint"
],
"default": "Hint",
"description": "Controls the severity level (underline) of a function/const that throws."
},
"doesItThrow.callToThrowSeverity": {
"scope": "resource",
"type": "string",
"enum": ["Error", "Warning", "Information", "Hint"],
"enum": [
"Error",
"Warning",
"Information",
"Hint"
],
"default": "Hint",
"description": "Controls the severity level (underline) of a function/const that calls a function that throws in the same file."
},
"doesItThrow.callToImportedThrowSeverity": {
"scope": "resource",
"type": "string",
"enum": ["Error", "Warning", "Information", "Hint"],
"enum": [
"Error",
"Warning",
"Information",
"Hint"
],
"default": "Hint",
"description": "Controls the severity level (underline) of a function/const that calls a function that throws in a different file."
},
Expand All @@ -100,7 +130,11 @@
"doesItThrow.trace.server": {
"scope": "window",
"type": "string",
"enum": ["off", "messages", "verbose"],
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "Enable for debug mode. Traces the communication between VS Code and the language server."
}
Expand All @@ -119,8 +153,13 @@
"build": "bun run build.ts",
"vscode:release": "vsce publish",
"vscode:package": "vsce package",
"format": "biome format ."
"format": "biome format .",
"pack:server": "cp README.md server/README.md && cp LICENSE.txt server/LICENSE.txt && npm pack --workspace server",
"publish:server": "npm publish --workspace server"
},
"types": "index.d.ts",
"workspaces": ["client", "server"]
}
"workspaces": [
"client",
"server"
]
}
3 changes: 3 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
".": {
"release-type": "node"
},
"server": {
"release-type": "node"
},
"crates/does-it-throw": {
"release-type": "rust"
},
Expand Down
3 changes: 3 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
out
README.md
LICENSE.txt
assets
4 changes: 4 additions & 0 deletions server/bin/does-it-throw
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

const path = require('path');
require(path.join(__dirname, '..', 'out', 'server.js'))
30 changes: 22 additions & 8 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
{
"name": "vscode-does-it-throw-server",
"description": "Example implementation of a language server in node.",
"version": "0.1.6",
"author": "Microsoft Corporation",
"name": "does-it-throw-lsp",
"description": "Language Server for Does It Throw",
"version": "0.2.5",
"author": {
"name": "Michael Angelo",
"email": "[email protected]"
},
"license": "MIT",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/michaelangeloio/does-it-throw/blob/main/LICENSE"
}
],
"engines": {
"node": "*"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-extension-samples"
},
"repository": "https://github.com/michaelangeloio/does-it-throw",
"categories": ["Programming Languages", "Linters", "Debuggers"],
"keywords": ["does it throw", "throw finder", "throw", "javascript", "typescript", "lsp", "language server"],
"qna": "https://github.com/michaelangeloio/does-it-throw/discussions",
"dependencies": {
"vscode-languageserver": "^9.0.1",
"vscode-languageserver-textdocument": "^1.0.8"
},
"files": ["out", "package.json", "README.md", "LICENSE.txt", "bin"],
"main": "out/server.js",
"bin": {
"does-it-throw-lsp": "./bin/does-it-throw"
},
"scripts": {}
}

0 comments on commit 6152786

Please sign in to comment.