Skip to content

Commit 3c78eec

Browse files
JamesDoingStuffgarryod
authored andcommitted
Add VS Code installation instructions
1 parent a7d8b11 commit 3c78eec

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,58 @@ It requires:
4848
3. Open Neovim and run `:TSInstall topas`. Once the installation has completed, highlighting should be active for TOPAS. Check by running `:checkhealth nvim-treesitter` and looking for a tick
4949
in the first column of the row labelled `topas`.
5050

51+
#
52+
### VS Code
53+
54+
Through a third-party extension, this grammar can be used to provide semantic highlighting for TOPAS `.inp` files in Visual Studio Code.
55+
56+
**Requirements:**
57+
- [VS Code](https://code.visualstudio.com/download)
58+
- The [tree-sitter-vscode](https://marketplace.visualstudio.com/items?itemName=AlecGhost.tree-sitter-vscode) extension
59+
60+
1. You will also need local copies of `tree-sitter-topas.wasm` and `highlights.scm`, included in [each release](https://github.com/JamesDoingStuff/tree-sitter-topas/releases).
61+
Experimental versions of the .wasm file can also be sourced as artifacts of the [CI workflow](https://github.com/JamesDoingStuff/tree-sitter-topas/actions/workflows/ci.yml).
62+
63+
2. In the `package.json` for the tree-sitter-vscode extension, add the following key to the "contributes" section:
64+
65+
```JSON
66+
"languages": [
67+
{
68+
"id": "topas",
69+
"extensions": [
70+
".inp"
71+
]
72+
}
73+
]
74+
```
75+
76+
If you are having trouble locating the `package.json`, bring up the command palette (`Ctrl`+`shift`+`P`), use the command
77+
`> Extensions: Open extensions folder`, then look in the folder `alecghost.tree-sitter-vscode-0.0.1`
78+
79+
3. In that same file, change the `activationEvents` array to the following:
80+
81+
```JSON
82+
"activationEvents": [
83+
"onLanguage:topas"
84+
]
85+
```
86+
87+
4. In your `settings.json` (`> Open user settings (JSON)`), add the following, updating the file paths to point to the respective files:
88+
89+
```JSON
90+
"tree-sitter-vscode.languageConfigs": [
91+
{
92+
"lang": "topas",
93+
"parser": "/path/to/tree-sitter-topas.wasm",
94+
"highlights": "/path/to/highlights.scm"
95+
}
96+
]
97+
```
98+
99+
5. Now, a `.inp` file should register as having a language mode of 'topas' in the lower right corner of VS Code. To turn on highlighting, open settings (`Ctrl`+`,`), search for 'semantic highlighting'
100+
and make sure `Editor > Semantic Higlighting` is enabled.
101+
102+
51103
## Features
52104

53105
- [x] Comments

0 commit comments

Comments
 (0)