Skip to content

Commit d99d397

Browse files
committed
feat: Create a VSCode extension
1 parent aeba70d commit d99d397

24 files changed

+7364
-20
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ updates:
1515
commit-message:
1616
prefix: chore
1717
include: scope
18+
- package-ecosystem: npm
19+
directory: /vscode-extension
20+
schedule:
21+
interval: monthly
22+
commit-message:
23+
prefix: chore
24+
include: scope

.github/release-please-config.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
".": {
55
"release-type": "simple",
66
"bump-minor-pre-major": true,
7-
"include-v-in-tag": true,
8-
"extra-files": ["README.md"]
7+
"include-v-in-tag": true
8+
},
9+
"vscode-extension": {
10+
"bump-minor-pre-major": true,
11+
"include-v-in-tag": true
912
}
1013
}
1114
}
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
2-
name: Assets
2+
name: Release
33
on:
44
push:
55
tags: ["v*"]
66
jobs:
77
release:
8-
name: Assets
8+
name: Release
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout code
@@ -14,6 +14,10 @@ jobs:
1414
uses: actions/setup-go@v5
1515
with:
1616
go-version-file: go.mod
17+
- name: Set up Node
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '22'
1721
- name: Install Cosign
1822
uses: sigstore/cosign-installer@v3
1923
- name: Create app token
@@ -36,3 +40,11 @@ jobs:
3640
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
3741
COSIGN_KEY: ${{ secrets.COSIGN_KEY }}
3842
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
43+
- name: Install dependencies
44+
run: npm ci
45+
working-directory: vscode-extension
46+
- name: Publish VSCode extension
47+
run: npm run publish
48+
working-directory: vscode-extension
49+
env:
50+
VSCE_PAT: ${{ secrets.VSCE_PAT }}

.github/workflows/vscode-ci.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
2+
name: VSCode Extension CI
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'vscode-extension/**'
8+
- '.github/workflows/ci-vscode.yaml'
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- 'vscode-extension/**'
13+
- '.github/workflows/ci-vscode.yaml'
14+
jobs:
15+
test:
16+
name: Test
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
- name: Set up Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '22'
25+
- name: Install dependencies
26+
run: npm ci
27+
working-directory: vscode-extension
28+
- name: Check types
29+
run: npm run typecheck
30+
working-directory: vscode-extension
31+
- name: Lint
32+
run: npm run lint
33+
working-directory: vscode-extension
34+
- name: Check formatting
35+
run: npm run format:check
36+
working-directory: vscode-extension
37+
- name: Run tests
38+
run: xvfb-run -a npm test
39+
working-directory: vscode-extension

README.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,35 @@ External editor support for `.gdshader` files.
1616
1717
Godot's shader language is powerful, but editing `.gdshader` files outside the
1818
Godot editor is painful. This project aims to bring proper language tooling
19-
(autocomplete, hover, references, etc.) to editors like Neovim and VSCode.
19+
(autocomplete, hover, references, etc.) to editors like Neovim and VSCode. It
20+
aims to be memory-efficient and editor-agnostic.
2021

2122
## 🌱 Prior Work
2223

23-
[@GodOfAvacyn](https://github.com/GodOfAvacyn) is the wonderful author of the
24-
[treesitter plugin](https://github.com/GodOfAvacyn/tree-sitter-gdshader) and
25-
[language server](https://github.com/GodOfAvacyn/gdshader-lsp) for the Godot
26-
shader language. Their treesitter plugin is great! As of writing, their
27-
language server has many false positive diagnostics, and the project became
28-
inactive while they were
29-
[working on a full rewrite](https://github.com/GodOfAvacyn/gdshader-lsp/issues/3#issuecomment-2176364609).
30-
I decided to start this new project to fill the gap for myself.
24+
1. [@GodOfAvacyn](https://github.com/GodOfAvacyn) is the author of the
25+
[treesitter plugin](https://github.com/GodOfAvacyn/tree-sitter-gdshader) and
26+
[language server](https://github.com/GodOfAvacyn/gdshader-lsp) for the Godot
27+
shader language. Their treesitter plugin is great! As of writing, their
28+
language server has many false positive diagnostics, and the project became
29+
inactive while they were [working on a full
30+
rewrite](https://github.com/GodOfAvacyn/gdshader-lsp/issues/3#issuecomment-2176364609).
31+
32+
2. [@AlfishSoftware](https://github.com/AlfishSoftware) is the author of the
33+
[Godot Files VSCode
34+
Extension](https://github.com/AlfishSoftware/godot-files-vscode), which
35+
includes some support for `.gdshader` files. However, it is VSCode-only. If
36+
you are a VSCode user, I recommend checking it out!
37+
38+
3. There is an [official Godot VSCode
39+
plugin](https://github.com/godotengine/godot-vscode-plugin), but it has
40+
minimal shader support and is VSCode-only.
3141

3242
## 📦 Install
3343

3444
### Neovim
3545

36-
1. Install by downloading the
37-
[latest release](https://github.com/armsnyder/gdshader-language-server/releases/latest)
38-
or building from source:
46+
1. Download the [latest release](https://github.com/armsnyder/gdshader-language-server/releases/latest)
47+
or build from source:
3948

4049
```shell
4150
wget https://github.com/armsnyder/gdshader-language-server/releases/latest/download/gdshader-language-server_$(uname -s)_$(uname -m).tar.gz
@@ -47,9 +56,9 @@ I decided to start this new project to fill the gap for myself.
4756
go install github.com/armsnyder/gdshader-language-server@latest
4857
```
4958

50-
1. Create a `~/.config/nvim/after/ftplugin/gdshader.lua` file with the following
51-
content, adjusting the path to the `gdshader-language-server` binary if
52-
necessary:
59+
1. Create a `~/.config/nvim/after/ftplugin/gdshader.lua` file with the
60+
following content, adjusting the path to the `gdshader-language-server`
61+
binary if necessary:
5362

5463
```lua
5564
vim.lsp.start({
@@ -61,7 +70,7 @@ I decided to start this new project to fill the gap for myself.
6170

6271
### VSCode
6372

64-
Coming soon? Contributions welcome!
73+
Work in progress
6574

6675
## Roadmap
6776

@@ -80,6 +89,8 @@ Planned features:
8089
- [ ] VSCode wrapper extension
8190
- [ ] Make the code more maintainable by generating rules based on the official
8291
Godot documentation
92+
- [ ] [Grammar](https://code.visualstudio.com/api/references/contribution-points#contributes.grammars)
93+
for the VSCode extension
8394

8495
## 🤝 Contributing
8596

vscode-extension/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules/
2+
/.vscode-test/
3+
4+
# These files are copied from the repo root during CI
5+
/cosign.pub
6+
/CHANGELOG.md

vscode-extension/.vscode-test.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { defineConfig } from "@vscode/test-cli";
2+
import fs from "fs";
3+
import url from "url";
4+
import path from "path";
5+
6+
function detectMinimumVSCodeVersion() {
7+
const __filename = url.fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const packageJsonPath = path.join(__dirname, "package.json");
10+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
11+
const vscodeVersion = packageJson.engines.vscode.replace(/^\^/, "");
12+
return vscodeVersion;
13+
}
14+
15+
export default defineConfig([
16+
{
17+
version: "stable",
18+
files: "**/*.test.js",
19+
},
20+
{
21+
version: detectMinimumVSCodeVersion(),
22+
files: "**/*.test.js",
23+
},
24+
]);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"runtimeExecutable": "${execPath}",
9+
"args": [
10+
"--disable-extensions",
11+
"--extensionDevelopmentPath=${workspaceFolder}"
12+
]
13+
}
14+
]
15+
}

vscode-extension/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[![GitHub Repo Stars](https://img.shields.io/github/stars/armsnyder/gdshader-language-server)](https://github.com/armsnyder/gdshader-language-server)
2+
[![GitHub Issues](https://img.shields.io/github/issues/armsnyder/gdshader-language-server)](https://github.com/armsnyder/gdshader-language-server/issues)
3+
[![Go Report Card](https://goreportcard.com/badge/github.com/armsnyder/gdshader-language-server)](https://goreportcard.com/report/github.com/armsnyder/gdshader-language-server)
4+
5+
This extension provides language support for Godot's `.gdshader` files.
6+
7+
### 🚧 Preview Status
8+
9+
This extension is in its early stages and currently only supports basic keyword
10+
completion. Once I deem it useful enough I will remove the preview status.

vscode-extension/eslint.config.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import js from "@eslint/js";
2+
import { defineConfig, globalIgnores } from "eslint/config";
3+
import globals from "globals";
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
export default defineConfig([
7+
globalIgnores([".vscode-test/**", "node_modules/**"]),
8+
js.configs.recommended,
9+
{
10+
files: ["**/*.js"],
11+
languageOptions: {
12+
globals: {
13+
...globals.commonjs,
14+
...globals.node,
15+
...globals.mocha,
16+
},
17+
ecmaVersion: 2022,
18+
sourceType: "commonjs",
19+
},
20+
},
21+
]);

0 commit comments

Comments
 (0)