Skip to content

Commit ec16634

Browse files
committed
feat: Add WGSL language server as user defined
Signed-off-by: azerr <azerr@redhat.com>
1 parent 6f41f6d commit ec16634

12 files changed

Lines changed: 171 additions & 0 deletions

File tree

447 KB
Loading
84 KB
Loading
150 KB
Loading
64.1 KB
Loading
70.4 KB
Loading
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# WGSL Analyzer
2+
3+
To enable [WGSL](https://www.w3.org/TR/WGSL/) language support in your IDE, you can integrate the [wgsl-analyzer](https://github.com/wgsl-analyzer/wgsl-analyzer) by following these steps:
4+
5+
![WGSL Analyzer demo](../images/user-defined-ls/wgsl-analyzer/demo_ls.gif)
6+
7+
---
8+
9+
## Step 1: Install the Language Server
10+
11+
1. Open an `.wgsl` file in your project.
12+
2. Click on **Install WGSL Analyzer**:
13+
14+
![Open file](../images/user-defined-ls/wgsl-analyzer/open_file.png)
15+
16+
3. This will open the [New Language Server Dialog](../UserDefinedLanguageServer.md#new-language-server-dialog) with `Astro Language Server` pre-selected:
17+
18+
![New Language Server Dialog](../images/user-defined-ls/wgsl-analyzer/new_language_server_dialog.png)
19+
20+
4. Click **OK**. This will create the `WGSL Analyzer` definition and start the installation:
21+
22+
![Installing Language Server](../images/user-defined-ls/wgsl-analyzer/language_server_installing.png)
23+
24+
5. Once the installation completes, the server should start automatically and provide [WGSL](https://www.w3.org/TR/WGSL/) language support (autocomplete, diagnostics, etc.).
25+
26+
### Troubleshooting Installation
27+
28+
If the installation fails, you can customize the installation settings in the **Installer** tab,
29+
then click on the **Run Installation** hyperlink to reinstall the server:
30+
31+
![Installer tab](../images/user-defined-ls/wgsl-analyzer/installer_tab.png)
32+
33+
See [Installer descriptor](../UserDefinedLanguageServerTemplate.md#installer-descriptor) for more information.
34+
35+
---
36+
37+
## Step 2: Install TextMate Bundle
38+
39+
Since IntelliJ does not provide native WGSL TextMate support, and the language server does not handle syntax highlighting, you need to set up a TextMate bundle manually.
40+
41+
* Clone the wgsl-analyzer repository:
42+
43+
```bash
44+
git clone https://github.com/wgsl-analyzer/wgsl-analyzer.git
45+
46+
* Open TextMate Bundles settings
47+
48+
![TextMate Bundles Settings](../images/user-defined-ls/textmate_bundles_settings.png)
49+
50+
* Click the `+` button and select the folder [wgsl-analyzer/editors/code](https://github.com/wgsl-analyzer/wgsl-analyzer/tree/main/editors/code) folder.
51+
This folder contains the package.json and the TextMate grammar.
52+
53+
Once done, IntelliJ will apply syntax highlighting, bracket matching, and other basic editor features for .wgsl files.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"caseSensitive": true,
3+
"lineCommentPrefix": "//",
4+
"blockCommentPrefix": "/*",
5+
"blockCommentSuffix": "*/",
6+
"statementTerminatorCharacters": ";",
7+
"completion": {
8+
"useContextAwareSorting": true,
9+
"useTemplateForInvocationOnlySnippet": false
10+
},
11+
"workspaceSymbol": {
12+
"supportsGotoClass": true
13+
}
14+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"testTree": true
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependency-scheme": "jar",
3+
"auto-add-ns-to-new-files?": true,
4+
"document-formatting?": false,
5+
"document-range-formatting?": false
6+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"id": "wgsl-analyzer-installer",
3+
"name": "wgsl-analyzer",
4+
"executeOnStartServer": false,
5+
"check": {
6+
"exec": {
7+
"name": "Trying current command",
8+
"command": "${server.command}",
9+
"timeout": 2000
10+
}
11+
},
12+
"run": {
13+
"download": {
14+
"name": "Download wgsl-analyzer",
15+
"github": {
16+
"owner": "wgsl-analyzer",
17+
"repository": "wgsl-analyzer",
18+
"prerelease": false,
19+
"asset": {
20+
"windows": {
21+
"x86_64": "wgsl-analyzer-x86_64-pc-windows-msvc.zip",
22+
"x86": "wgsl-analyzer-i686-pc-windows-msvc.zip",
23+
"arm64": "wgsl-analyzer-aarch64-pc-windows-msvc.zip"
24+
},
25+
"unix": {
26+
"x86_64": "wgsl-analyzer-x86_64-unknown-linux-gnu.gz",
27+
"arm64": "wgsl-analyzer-aarch64-unknown-linux-gnu.gz"
28+
},
29+
"mac": "wgsl-analyzer-aarch64-apple-darwin.gz"
30+
}
31+
},
32+
"output": {
33+
"dir": "$USER_HOME$/.lsp4ij/lsp/wgsl-analyzer",
34+
"file": {
35+
"name": {
36+
"windows": "wgsl-analyzer.exe",
37+
"unix": {
38+
"x86_64": "wgsl-analyzer-x86_64-unknown-linux-gnu",
39+
"arm64": "wgsl-analyzer-aarch64-unknown-linux-gnu"
40+
},
41+
"mac": "wgsl-analyzer-aarch64-apple-darwin"
42+
},
43+
"executable": true
44+
}
45+
},
46+
"onSuccess": {
47+
"configureServer": {
48+
"name": "Configure WSGL Language server command",
49+
"command": "${output.dir}/${output.file.name}",
50+
"update": true
51+
}
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)