Shards language Support in VSCode.
This extension provides comprehensive support for the Shards programming language in Visual Studio Code. Developed in TypeScript
and tmLanguage
, the extension offers:
- Syntax highlighting
- Custom shards path
- Go to definitions
- Wires
- Cross-file
- Variables
- @define
- @template
- macro
- mesh
- Wires
- Go to references
- Outline
- Meshes with go to definitions
- Wire definitions with go to definitions
- Variable definitions with go definitions
- Wire references (activator type too?) with go to definitions
- Red file on:
- no ast
- duplicate wire definitions
- Red squiggle under duplicate wire definitions
- Warnings:
- Shards executable wasn't found. Try to show only once, in case user only wants syntax highlighting.
Grab it from the VS Code Marketplace, or issue the command:
code --install-extension fragcolor.shards
You could also copy this repo or just copy the relevant files to <user home>/.vscode/extensions
folder in VS Code. Check the relevant files with vsce ls
.
- Setup full path to shards executable in the settings: search for "shards"
- Open any
.shs
file to activate the extension.
Development using TypeScript and VS Code debugger.
Install dependencies:
npm install
Compile in watch mode:
npm run compile
Start debugging this extension:
- Go to Run -> Start Debugging to open a new window with your extension loaded.
- Set breakpoints in your code inside
src/extension.ts
to debug your extension.
Syntax highlighting: Verify code is highlighted and that the language configuration settings are working. Try with shards*.shs
files. To inspect tokens and scopes for syntax highlighting, go to VS Code command palette, and run Developer: Inspect Editor Tokens and Scopes
.
Go to definition: Try with test*.shs
files.
Shards path: Go to settings, look for shards, setup a non-default path for shards and test with a go to definition.
When making changes to shards.tmLanguage.edn
, generate shards.tmLanguage.json
using a tool like jet, here as:
cat shards.tmLanguage.edn |jet --to=json > shards.tmLanguage.json
Reload (Ctrl+R
or Cmd+R
on Mac) the VS Code window with your extension to load your changes. Otherwise, relaunch the extension from the debug toolbar.
Build code for release:
npm run compile
Make sure you're going to publish the required and only the required files:
vsce ls
Bump the version
number in package.json
before publishing this extension, then:
vsce package
Finally, upload the generated .vsix
file to the Fragcolor's VS Code marketplace if you're a member of the organization, or in your own stall.
The package.json
file is the entry point of the extension.
The highlight folder contains all of the files necessary for syntax highlighting.
package.json
- this is the manifest file declaring language support and locating the grammar file.shards.tmLanguage.json
- this is the Text mate grammar file that is used for tokenization, generated fromshards.tmLanguage.edn
.language-configuration.json
- this is the language configuration, defining the tokens that are used for comments and brackets.
The src folder contains the TypeScript code implementing the language features:
extension.ts
- Main extension activation and setupdefinitionProvider.ts
- Implements go-to-definition functionalitysymbolProvider.ts
- Implements document symbol outline functionality
Contributions are welcome! Feel free to open an issue or submit a pull request.
To share this extension with the world, read on about publishing an extension.
vscode-shards-syntax source code is licensed under the BSD 3-Clause license.