Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: bring VS Code extension into this repo #1271

Merged
merged 12 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ jobs:
registry-url: "https://registry.npmjs.org"
- name: Build all packages
run: yarn build
- name: Publish all packages
- name: Publish npm packages
run: npm publish --workspaces
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish VS Code extension
run: npx vsce publish --baseImagesUrl="https://github.com/penrose/penrose/raw/${GITHUB_REF#refs/tags/}/packages/vscode"
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"packages/optimizer",
"packages/roger",
"packages/synthesizer",
"packages/synthesizer-ui"
"packages/synthesizer-ui",
"packages/vscode"
],
"nohoist": [
"**/@types/jest",
Expand Down
1 change: 1 addition & 0 deletions packages/vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.vsix
11 changes: 11 additions & 0 deletions packages/vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"]
}
]
}
7 changes: 7 additions & 0 deletions packages/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**
!languages/
!LICENSE
!package.json
!README.md
!resources/
!syntaxes/
21 changes: 21 additions & 0 deletions packages/vscode/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions packages/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Penrose for VS Code

Supports `.domain`, `.style`, and `.substance` for [Penrose](https://penrose.cs.cmu.edu).
17 changes: 17 additions & 0 deletions packages/vscode/languages/common-language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"comments": {
"blockComment": ["/*", "*/"],
"lineComment": "--"
},
"brackets": [
["(", ")"],
["[", "]"],
["{", "}"]
],
"autoClosingPairs": [
["(", ")"],
["[", "]"],
["{", "}"],
["\"", "\""]
]
}
88 changes: 88 additions & 0 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"name": "penrose-vs",
"displayName": "Penrose",
"publisher": "penrose",
"description": "Penrose languages bundle",
"version": "2.1.1",
"author": "Penrose Team (https://penrose.cs.cmu.edu/)",
"license": "MIT",
"private": true,
"engines": {
"vscode": "^1.52.0"
},
"categories": [
"Other",
"Snippets",
"Programming Languages"
],
"activationEvents": [
"onLanguage:penrose-style"
],
"icon": "resources/icon.png",
"repository": {
"type": "git",
"url": "https://github.com/penrose/penrose",
"directory": "packages/vscode"
},
"contributes": {
"languages": [
{
"id": "penrose-style",
"aliases": [
"Penrose Style"
],
"extensions": [
".style"
],
"configuration": "./languages/common-language-configuration.json"
},
{
"id": "penrose-domain",
"aliases": [
"Penrose Domain"
],
"extensions": [
".domain"
],
"configuration": "./languages/common-language-configuration.json"
},
{
"id": "penrose-substance",
"aliases": [
"Penrose Substance"
],
"extensions": [
".substance"
],
"configuration": "./languages/common-language-configuration.json"
}
],
"grammars": [
{
"scopeName": "source.penrose-common",
"path": "./syntaxes/common.tmGrammar.json"
},
{
"language": "penrose-style",
"scopeName": "source.penrose-style",
"path": "./syntaxes/style.tmGrammar.json"
},
{
"language": "penrose-domain",
"scopeName": "source.penrose-domain",
"path": "./syntaxes/domain.tmGrammar.json"
},
{
"language": "penrose-substance",
"scopeName": "source.penrose-substance",
"path": "./syntaxes/substance.tmGrammar.json"
}
]
},
"scripts": {
"package": "vsce package --yarn"
},
"devDependencies": {
"@vscode/vsce": "^2"
}
}
Binary file added packages/vscode/resources/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions packages/vscode/syntaxes/common.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "penrose-common",
"scopeName": "source.penrose-common",
"patterns": [{ "include": "#strings" }, { "include": "#comments" }],
"repository": {
"strings": {
"name": "string.quoted.double",
"match": "\"(?:[^\n\\\"]|\\[\"\\ntbfr])*\""
},
"comments": {
"patterns": [
{
"name": "comment.block.penrose",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "comment.line.penrose",
"match": "--.*?$"
}
]
}
}
}
29 changes: 29 additions & 0 deletions packages/vscode/syntaxes/domain.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "penrose-domain",
"scopeName": "source.penrose-domain",
"fileTypes": [".domain"],
"patterns": [
{ "include": "#keywords" },
{ "include": "#operators" },
{ "include": "source.penrose-common" }
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.penrose",
"match": "\\b(type|value|constructor|function|predicate|notation|Prop)\\b"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.other.penrose.rarrow",
"match": "->"
}
]
}
}
}
34 changes: 34 additions & 0 deletions packages/vscode/syntaxes/style.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "penrose-style",
"scopeName": "source.penrose-style",
"fileTypes": [".style"],
"patterns": [
{ "include": "#numbers" },
{ "include": "#keywords" },
{ "include": "source.penrose-common" }
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.penrose",
"match": "\\b(forall|where|with|delete|as|true|false|layer|encourage|ensure|override)\\b"
},
{
"name": "entity.other.attribute-name.penrose.layering",
"match": "\\b(above|below)\\b"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.float",
"match": "\\b[+-]?(?:\\d+(?:[.]\\d*)?(?:[eE][+-]?\\d+)?|[.]\\d+(?:[eE][+-]?\\d+)?)\\b"
},
{ "name": "constant.numeric.penrose.hole", "match": "\\?" }
]
}
}
}
24 changes: 24 additions & 0 deletions packages/vscode/syntaxes/substance.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "penrose-substance",
"scopeName": "source.penrose-substance",
"fileTypes": [".substance"],
"patterns": [
{ "include": "#keywords" },
{ "include": "#latex" },
{ "include": "source.penrose-common" }
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.penrose",
"match": "\\b(AutoLabel|Label|NoLabel|All)\\b"
}
]
},
"latex": {
"patterns": [{ "name": "constant.language.penrose", "match": "\\$.*\\$" }]
}
}
}
4 changes: 4 additions & 0 deletions penrose.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
{
"name": "📦 @penrose/synthesizer-ui",
"path": "packages/synthesizer-ui"
},
{
"name": "📦 penrose-vs",
"path": "packages/vscode"
}
],
"settings": {
Expand Down