Skip to content

Add language support for GYB #1515

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .unacceptablelanguageignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
assets/swift-docc-render
src/utilities/utilities.ts
src/tasks/SwiftProcess.ts
syntaxes/swift-gyb.tmLanguage.json
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
!assets/documentation-webview/**
!assets/swift-docc-render/**
!node_modules/@vscode/codicons/**
!swift-gyb.language-configuration.json
!syntaxes/**
245 changes: 244 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 28 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,28 @@
"filenamePatterns": [
"*.tutorial"
]
},
{
"id": "swift-gyb",
"aliases": [
"Swift GYB"
],
"extensions": [
".swift.gyb"
],
"configuration": "./swift-gyb.language-configuration.json"
}
],
"grammars": [
{
"language": "swift-gyb",
"scopeName": "source.swift.gyb",
"path": "./syntaxes/swift-gyb.tmLanguage.json",
"embeddedLanguages": {
"meta.embedded.block.gyb": "python",
"meta.embedded.control.begin.gyb": "python",
"meta.embedded.expression.gyb": "python"
}
}
],
"snippets": [
Expand Down Expand Up @@ -1660,7 +1682,8 @@
"pretest": "npm run compile-tests",
"soundness": "scripts/soundness.sh",
"check-package-json": "tsx ./scripts/check_package_json.ts",
"test": "vscode-test",
"test": "vscode-test && npm run grammar-test",
"grammar-test": "vscode-tmgrammar-test 'test/unit-tests/**/*.test.swift.gyb' -g test/unit-tests/syntaxes/swift.tmLanguage.json -g test/unit-tests/syntaxes/MagicPython.tmLanguage.json",
"integration-test": "npm test -- --label integrationTests",
"unit-test": "npm test -- --label unitTests",
"coverage": "npm test -- --coverage",
Expand All @@ -1677,8 +1700,8 @@
"@types/chai-subset": "^1.3.6",
"@types/glob": "^7.1.6",
"@types/lcov-parse": "^1.0.2",
"@types/lodash.throttle": "^4.1.9",
"@types/lodash.debounce": "^4.0.9",
"@types/lodash.throttle": "^4.1.9",
"@types/mocha": "^10.0.10",
"@types/mock-fs": "^4.13.4",
"@types/node": "^20.17.30",
Expand All @@ -1701,8 +1724,8 @@
"esbuild": "^0.25.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^10.1.2",
"lodash.throttle": "^4.1.1",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"mocha": "^10.8.2",
"mock-fs": "^5.5.0",
"node-pty": "^1.0.0",
Expand All @@ -1714,7 +1737,8 @@
"source-map-support": "^0.5.21",
"strip-ansi": "^6.0.1",
"tsx": "^4.19.3",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"vscode-tmgrammar-test": "^0.1.3"
},
"dependencies": {
"@vscode/codicons": "^0.0.36",
Expand Down
17 changes: 17 additions & 0 deletions swift-gyb.language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"brackets": [["{", "}"]],
"autoClosingPairs": [
["%{", "}%"],
["${", "}"]
],
"surroundingPairs": [
["%{", "}%"],
["${", "}"]
],
"folding": {
"markers": {
"start": "^\\s*(?:%\\{|%[^\\{].*?:)",
"end": "^\\s*(?:\\}%|%\\s*end\\b)"
}
}
}
Loading