Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Baccata committed Nov 22, 2021
0 parents commit 9bf8902
Show file tree
Hide file tree
Showing 12 changed files with 2,513 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
tags: ["v*"]
pull_request:
branches: ["*"]

name: Build and deploy
jobs:
build:
if: github.event_name == 'pull_request'
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: borales/[email protected]
with:
cmd: install # will run `yarn install` command
- uses: borales/[email protected]
with:
cmd: build # will run `yarn build` command

deploy:
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- uses: lannonbr/[email protected]
with:
# using the git tag as a version, dropping the first character (v)
args: "publish -p $VSCE_TOKEN --no-git-tag-version `git describe --abbrev=0 | tail -c +2`"
env:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
client/node_modules
node_modules
node_modules
*.vsix
5 changes: 5 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode/**
.vscode-test/**
out/test/**
out/**/*.map
src/**
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Smithy VS Code extension

[Smithy](https://awslabs.github.io/smithy/) is an open-source protocol-agnostic interface definition language maintained and published by AWS.

This VSCode extension provides syntax coloring and rich editor features when editing .smithy files files.

It works by communicating to a language-server published in
https://github.com/disneystreaming/smithy-language-server/

## Installation

## This extension contains:

* Client code to communicate with a [Smithy LSP server](https://github.com/disnenystreaming/smithy-language-server). In particular, this should handle :
* Jump to definition
* Diagnostics
* Basic auto-completion
* Simple grammar for Smithy syntax highlighting

Binary file added coursier
Binary file not shown.
Binary file added images/hammer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//"
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
97 changes: 97 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"name": "smithy",
"description": "Smithy vscode extension",
"author": "Olivier Mélois",
"version": "0.0.0-SNAPSHOT",
"icon": "images/hammer.png",
"publisher": "disneystreaming",
"repository": {
"type": "git",
"url": "https://github.com/disneystreaming/vscode-smithy"
},
"categories": [],
"keywords": [
"smithy"
],
"activationEvents": [
"onLanguage:smithy"
],
"main": "./out/extension",
"contributes": {
"configuration": {
"type": "object",
"title": "vscode-smithy configuration",
"properties": {
"smithyLsp.maxNumberOfProblems": {
"scope": "resource",
"type": "number",
"default": 100,
"description": "Controls the maximum number of problems produced by the server."
},
"smithyLsp.trace.server": {
"scope": "window",
"type": "string",
"enum": [
"off",
"messages",
"verbose"
],
"default": "verbose",
"description": "Traces the communication between VS Code and the language server."
},
"smithyLsp.version": {
"scope": "window",
"type": "string",
"default": "0.0.0-cb3ffec",
"description": "Version of the Smithy LSP (see https://github.com/disneystreaming/smithy-language-server)"
}
}
},
"languages": [
{
"id": "smithy",
"extensions": [
".smithy"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "smithy",
"scopeName": "source.smithy",
"path": "./smithy.tmGrammar.json"
}
]
},
"scripts": {
"vscode:prepublish": "yarn compile",
"prepublishOnly": "vsce package -o extension.vsix",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"test": "yarn compile",
"build": "vsce package --yarn",
"format": "prettier --write '**/*.{ts,js,json,yml}'",
"format-check": "prettier --check '**/*.{ts,js,json,yml}'"
},
"files": [
"extension.vsix"
],
"engines": {
"vscode": "^1.43.0"
},
"dependencies": {
"vscode-languageclient": "^6.1.3"
},
"devDependencies": {
"@types/mocha": "^8.0.3",
"@types/node": "^12.12.0",
"@types/vscode": "1.43.0",
"@typescript-eslint/parser": "^2.3.0",
"eslint": "^6.4.0",
"mocha": "^8.1.1",
"typescript": "^4.0.2",
"vsce": "^1.87.1",
"vscode-test": "^1.3.0"
}
}
174 changes: 174 additions & 0 deletions smithy.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"scopeName": "source.smithy",
"patterns": [
{
"include": "#expression"
},
{
"include": "#comments"
},
{
"include": "#traits"
},
{
"include": "#camelcase"
},
{
"include": "#strings"
}
],
"repository": {
"expression": {
"patterns": [
{
"include": "#reserved"
},
{
"include": "#paren-expression"
},
{
"include": "#comments"
},
{
"include": "#traits"
}
]
},
"traits": {
"match": "@([\\w]+)\\b",
"name": "support.function"
},
"camelcase": {
"match": "\\b([A-Z](\\w+))\\b",
"name": "entity.name.class"
},
"strings": {
"patterns": [
{
"end": "\"",
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.smithy"
}
},
"patterns": [
{
"match": "\\\\(?:[btnfr\\\\\"']|[0-7]{1,3}|u[0-9A-Fa-f]{4})",
"name": "constant.character.escape.smithy"
},
{
"match": "\\\\.",
"name": "invalid.illegal.unrecognized-string-escape.smithy"
}
],
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.smithy"
}
},
"name": "string.quoted.double.smithy"
}
]
},
"reserved": {
"match": "\\b(service|operation|resource|structure|list|metadata|namespace|use|map|union|string|integer|set|blob|boolean|string|byte|short|integer|long|float|double|bigInteger|bigDecimal|timestamp|document)\\b",
"name": "keyword.control.reserved"
},
"builtin": {
"match": "\\b(Blob|Boolean|String|Byte|Short|Integer|Long|Float|Double|BigInteger|BigDecimal|Timestamp|Document)\\b",
"name": "constant.language"
},
"definition": {
"patterns": [
{
"match": "(?<=[^\\._$a-zA-Z0-9])(`[^`]+`|[_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)\\s*(:)\\s+",
"captures": {
"1": {
"name": "variable.parameter.smithy"
},
"2": {
"name": "meta.colon.smithy"
}
}
}
]
},
"traitparam": {
"patterns": [
{
"match": "(?<=[^\\._$a-zA-Z0-9])(`[^`]+`|[_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)\\s*(:)\\s+",
"captures": {
"1": {
"name": "variable.parameter.smithy"
},
"2": {
"name": "meta.colon.smithy"
}
}
}
]
},
"paren-expression": {
"begin": "\\{",
"end": "\\}",
"beginCaptures": {
"0": {
"name": "punctuation.bracket.open"
}
},
"endCaptures": {
"0": {
"name": "punctuation.bracket.close"
}
},
"name": "definition.group",
"patterns": [
{
"include": "#expression"
},
{
"include": "#builtin"
},
{
"include": "#traits"
},
{
"include": "#camelcase"
},
{"include": "#definition"},
{
"include": "#strings"
}
]
},
"comments": {
"patterns": [
{
"include": "#block-comments"
},
{
"end": "(?!\\G)",
"begin": "(^[ \\t]+)?(?=//)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.scala"
}
},
"patterns": [
{
"end": "\\n",
"begin": "//",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.scala"
}
},
"name": "comment.line.double-slash.scala"
}
]
}
]
}
}
}
Loading

0 comments on commit 9bf8902

Please sign in to comment.