Scaffold language server (#25)

* wip: scaffold astro extension

* wip: scaffold astro extension

* WIP: vscode extension

* fix: autoCloseBefore

* chore: update package.json

* fix: use tsx instead of plain ts

* chore: remove dist files

* chore: remove comments

* chore: cleanup package build process, switch build to esbuild

* refactor: use shared esbuild config

Co-authored-by: Nate Moore <nate@skypack.dev>
This commit is contained in:
Nate Moore 2021-03-25 10:38:17 -05:00 committed by GitHub
parent 30cccdf715
commit 18e7cc5af9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1594 additions and 1 deletions

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
node_modules/ node_modules/
lib/ lib/
dist/
*.tsbuildinfo
.DS_Store

22
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,22 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Extension",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/vscode"
],
"outFiles": [
"${workspaceRoot}/vscode/packages/client/out/**/*.js"
],
"preLaunchTask": {
"type": "npm",
"script": "watch:extension"
}
},
]
}

34
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,34 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "compile:extension",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"type": "npm",
"script": "watch:extension",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
}
]
}

View file

@ -20,7 +20,8 @@
"dev": "tsc --watch", "dev": "tsc --watch",
"lint": "eslint 'src/**/*.{js,ts}'", "lint": "eslint 'src/**/*.{js,ts}'",
"format": "prettier -w 'src/**/*.{js,ts}'", "format": "prettier -w 'src/**/*.{js,ts}'",
"test": "uvu test -i fixtures -i test-utils.js" "test": "uvu test -i fixtures -i test-utils.js",
"watch:extension": "cd vscode && npm run watch"
}, },
"dependencies": { "dependencies": {
"@babel/generator": "^7.13.9", "@babel/generator": "^7.13.9",

1
vscode/.vscodeignore Normal file
View file

@ -0,0 +1 @@
packages/

View file

@ -0,0 +1,36 @@
{
"comments": {
"blockComment": [ "<!--", "-->" ]
},
"brackets": [
["---", "---"],
["<!--", "-->"],
["<", ">"],
["{", "}"],
["(", ")"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}"},
{ "open": "[", "close": "]"},
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "<!--", "close": "-->", "notIn": [ "comment", "string" ]},
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
"autoCloseBefore": ";:.,=}])>` \n\t",
"surroundingPairs": [
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "{", "close": "}"},
{ "open": "[", "close": "]"},
{ "open": "(", "close": ")" },
{ "open": "<", "close": ">" }
],
"folding": {
"markers": {
"start": "^\\s*<!--\\s*#region\\b.*-->",
"end": "^\\s*<!--\\s*#endregion\\b.*-->"
}
}
}

234
vscode/package-lock.json generated Normal file
View file

@ -0,0 +1,234 @@
{
"name": "astro",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@astro-vscode/client": {
"version": "file:packages/client",
"dev": true,
"requires": {
"vscode-languageclient": "^7.1.0-next.4"
}
},
"@astro-vscode/server": {
"version": "file:packages/server",
"dev": true,
"requires": {
"vscode-html-languageservice": "^3.0.3",
"vscode-languageserver": "^6.1.1",
"vscode-languageserver-textdocument": "^1.0.1"
},
"dependencies": {
"astro": {
"version": "0.1.0",
"dependencies": {
"@astro-vscode/client": {
"version": "file:packages/client",
"dev": true,
"requires": {
"vscode-languageclient": "^7.1.0-next.4"
}
}
}
},
"vscode-html-languageservice": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-3.2.0.tgz",
"integrity": "sha512-aLWIoWkvb5HYTVE0kI9/u3P0ZAJGrYOSAAE6L0wqB9radKRtbJNrF9+BjSUFyCgBdNBE/GFExo35LoknQDJrfw==",
"dev": true,
"requires": {
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-languageserver-types": "3.16.0-next.2",
"vscode-nls": "^5.0.0",
"vscode-uri": "^2.1.2"
}
},
"vscode-jsonrpc": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz",
"integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==",
"dev": true
},
"vscode-languageserver": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-6.1.1.tgz",
"integrity": "sha512-DueEpkUAkD5XTR4MLYNr6bQIp/UFR0/IPApgXU3YfCBCB08u2sm9hRCs6DxYZELkk++STPjpcjksR2H8qI3cDQ==",
"dev": true,
"requires": {
"vscode-languageserver-protocol": "^3.15.3"
}
},
"vscode-languageserver-protocol": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz",
"integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==",
"dev": true,
"requires": {
"vscode-jsonrpc": "6.0.0",
"vscode-languageserver-types": "3.16.0"
},
"dependencies": {
"vscode-languageserver-types": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
"integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==",
"dev": true
}
}
},
"vscode-languageserver-textdocument": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz",
"integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==",
"dev": true
},
"vscode-languageserver-types": {
"version": "3.16.0-next.2",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.2.tgz",
"integrity": "sha512-QjXB7CKIfFzKbiCJC4OWC8xUncLsxo19FzGVp/ADFvvi87PlmBSCAtZI5xwGjF5qE0xkLf0jjKUn3DzmpDP52Q==",
"dev": true
},
"vscode-nls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==",
"dev": true
},
"vscode-uri": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz",
"integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==",
"dev": true
}
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"esbuild": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.10.0.tgz",
"integrity": "sha512-g+/Fk18bP7GAx0eG2RTfvjbsdB6RSchvvrrokFX8UexrTtPo0ZF0R1KViUu5v0A4Uu8m3I7pZhEyZveiOk0/JA==",
"dev": true
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": {
"yallist": "^4.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"vscode-html-languageservice": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-3.2.0.tgz",
"integrity": "sha512-aLWIoWkvb5HYTVE0kI9/u3P0ZAJGrYOSAAE6L0wqB9radKRtbJNrF9+BjSUFyCgBdNBE/GFExo35LoknQDJrfw==",
"requires": {
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-languageserver-types": "3.16.0-next.2",
"vscode-nls": "^5.0.0",
"vscode-uri": "^2.1.2"
},
"dependencies": {
"vscode-languageserver-types": {
"version": "3.16.0-next.2",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.2.tgz",
"integrity": "sha512-QjXB7CKIfFzKbiCJC4OWC8xUncLsxo19FzGVp/ADFvvi87PlmBSCAtZI5xwGjF5qE0xkLf0jjKUn3DzmpDP52Q=="
}
}
},
"vscode-jsonrpc": {
"version": "6.1.0-next.2",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.1.0-next.2.tgz",
"integrity": "sha512-nkiNDGI+Ytp7uj1lxHXddXCoEunhcry1D+KmVHBfUUgWT9jMF8ZJyH5KQObdF+OGAh7bXZxD/SV4uGwSCeHHWA==",
"dev": true
},
"vscode-languageclient": {
"version": "7.1.0-next.4",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.1.0-next.4.tgz",
"integrity": "sha512-Gal+DvbI1KIwO1z90MvSnghMCVBCGlwdpOVIS0Hhmep7rjHUOwuC5Df7YlVkpzfPm+RCRyZQnUSJ19VNrnxxhA==",
"dev": true,
"requires": {
"minimatch": "^3.0.4",
"semver": "^7.3.4",
"vscode-languageserver-protocol": "3.17.0-next.5"
}
},
"vscode-languageserver-protocol": {
"version": "3.17.0-next.5",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.0-next.5.tgz",
"integrity": "sha512-LFZ6WMB3iPezQAU9OnGoERzcIVKhcs0OLfD/NHcqSj3g1wgxuLUL5kSlZbbjFySQCmhzm6b0yb3hjTSeBtq1+w==",
"dev": true,
"requires": {
"vscode-jsonrpc": "6.1.0-next.2",
"vscode-languageserver-types": "3.17.0-next.1"
}
},
"vscode-languageserver-textdocument": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz",
"integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA=="
},
"vscode-languageserver-types": {
"version": "3.17.0-next.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.0-next.1.tgz",
"integrity": "sha512-VGzh06oynbYa6JbTKUbxOEZN7CYEtWhN7DK5wfzUpeCJl8X8xZX39g2PVfpqXrIEduu7dcJgK007KgnX9tHNKA==",
"dev": true
},
"vscode-nls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA=="
},
"vscode-uri": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz",
"integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
}
}
}

64
vscode/package.json Normal file
View file

@ -0,0 +1,64 @@
{
"name": "astro",
"displayName": "Astro",
"description": "Language support for Astro",
"version": "0.1.0",
"author": "Astro",
"publisher": "astro-build",
"license": "MIT",
"scripts": {
"vscode:prepublish": "npm run build",
"bootstrap": "cd packages/client && npm ci && cd ../server && npm ci",
"build": "node scripts/build.mjs",
"watch": "node scripts/watch.mjs"
},
"engines": {
"vscode": "^1.52.0"
},
"activationEvents": [
"*"
],
"dependencies": {
"vscode-html-languageservice": "^3.0.3"
},
"devDependencies": {
"esbuild": "0.10.0",
"@astro-vscode/client": "file:./packages/client",
"@astro-vscode/server": "file:./packages/server"
},
"main": "./dist/index.js",
"files": [
"dist/",
"languages/",
"syntaxes/"
],
"contributes": {
"languages": [
{
"id": "astro",
"extensions": [
".astro"
],
"aliases": [
"Astro"
],
"configuration": "./languages/astro-language-configuration.json"
}
],
"grammars": [
{
"language": "astro",
"scopeName": "text.html.astro",
"path": "./syntaxes/astro.tmLanguage.json",
"embeddedLanguages": {
"text.html.astro": "astro",
"text.html": "html",
"source.css": "css",
"source.scss": "scss",
"source.sass": "sass",
"source.tsx": "typescriptreact"
}
}
]
}
}

BIN
vscode/packages/.DS_Store vendored Normal file

Binary file not shown.

BIN
vscode/packages/client/.DS_Store vendored Normal file

Binary file not shown.

91
vscode/packages/client/package-lock.json generated Normal file
View file

@ -0,0 +1,91 @@
{
"name": "@astro-vscode/client",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/vscode": {
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.54.0.tgz",
"integrity": "sha512-sHHw9HG4bTrnKhLGgmEiOS88OLO/2RQytUN4COX9Djv81zc0FSZsSiYaVyjNidDzUSpXsySKBkZ31lk2/FbdCg==",
"dev": true
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"requires": {
"brace-expansion": "^1.1.7"
}
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"requires": {
"lru-cache": "^6.0.0"
}
},
"vscode-jsonrpc": {
"version": "6.1.0-next.2",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.1.0-next.2.tgz",
"integrity": "sha512-nkiNDGI+Ytp7uj1lxHXddXCoEunhcry1D+KmVHBfUUgWT9jMF8ZJyH5KQObdF+OGAh7bXZxD/SV4uGwSCeHHWA=="
},
"vscode-languageclient": {
"version": "7.1.0-next.4",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.1.0-next.4.tgz",
"integrity": "sha512-Gal+DvbI1KIwO1z90MvSnghMCVBCGlwdpOVIS0Hhmep7rjHUOwuC5Df7YlVkpzfPm+RCRyZQnUSJ19VNrnxxhA==",
"requires": {
"minimatch": "^3.0.4",
"semver": "^7.3.4",
"vscode-languageserver-protocol": "3.17.0-next.5"
}
},
"vscode-languageserver-protocol": {
"version": "3.17.0-next.5",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.0-next.5.tgz",
"integrity": "sha512-LFZ6WMB3iPezQAU9OnGoERzcIVKhcs0OLfD/NHcqSj3g1wgxuLUL5kSlZbbjFySQCmhzm6b0yb3hjTSeBtq1+w==",
"requires": {
"vscode-jsonrpc": "6.1.0-next.2",
"vscode-languageserver-types": "3.17.0-next.1"
}
},
"vscode-languageserver-types": {
"version": "3.17.0-next.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.0-next.1.tgz",
"integrity": "sha512-VGzh06oynbYa6JbTKUbxOEZN7CYEtWhN7DK5wfzUpeCJl8X8xZX39g2PVfpqXrIEduu7dcJgK007KgnX9tHNKA=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
}

View file

@ -0,0 +1,12 @@
{
"name": "@astro-vscode/client",
"version": "0.1.0",
"author": "Skypack",
"license": "MIT",
"dependencies": {
"vscode-languageclient": "next"
},
"devDependencies": {
"@types/vscode": "latest"
}
}

View file

@ -0,0 +1,30 @@
import * as vscode from 'vscode';
export async function activate() {
onConfigUpdated();
vscode.workspace.onDidChangeConfiguration(onConfigUpdated);
function onConfigUpdated() {
const astro = vscode.extensions.getExtension('skypack.astro');
if (!astro) {
return;
}
const emmet = vscode.extensions.getExtension('vscode.emmet');
if (!emmet) {
return;
}
const emmetIncludeLanguages = getEmmetIncludeLanguages();
if (emmetIncludeLanguages && emmetIncludeLanguages['astro']) {
return;
}
setEmmetIncludeLanguages({ ...emmetIncludeLanguages, astro: 'html' });
}
function getEmmetIncludeLanguages() {
return vscode.workspace.getConfiguration('emmet').get<Record<string, string>>('includeLanguages');
}
function setEmmetIncludeLanguages(value: Record<string, string>) {
return vscode.workspace.getConfiguration('emmet').set('includeLanguages', value);
}
}

View file

@ -0,0 +1,79 @@
import * as path from 'path';
import * as vscode from 'vscode';
import * as lsp from 'vscode-languageclient/node';
import * as defaultSettings from './features/defaultSettings.js';
let docClient: lsp.LanguageClient;
export async function activate(context: vscode.ExtensionContext) {
docClient = createLanguageService(context, 'doc', 'astro', 'Astro', 6040);
defaultSettings.activate();
await docClient.onReady();
startEmbeddedLanguageServices();
}
function createLanguageService(context: vscode.ExtensionContext, mode: 'doc', id: string, name: string, port: number) {
const serverModule = context.asAbsolutePath(path.join('dist', 'server.js'));
const debugOptions = { execArgv: ['--nolazy', '--inspect=' + port] };
const serverOptions: lsp.ServerOptions = {
run: { module: serverModule, transport: lsp.TransportKind.ipc },
debug: {
module: serverModule,
transport: lsp.TransportKind.ipc,
options: debugOptions,
},
};
const serverInitOptions: any = {
mode: mode,
appRoot: vscode.env.appRoot,
language: vscode.env.language,
};
const clientOptions: lsp.LanguageClientOptions = {
documentSelector: [{ scheme: 'file', language: 'astro' }],
initializationOptions: serverInitOptions,
};
const client = new lsp.LanguageClient(id, name, serverOptions, clientOptions);
context.subscriptions.push(client.start());
return client;
}
async function startEmbeddedLanguageServices() {
const ts = vscode.extensions.getExtension('vscode.typescript-language-features');
const css = vscode.extensions.getExtension('vscode.css-language-features');
const html = vscode.extensions.getExtension('vscode.html-language-features');
if (ts && !ts.isActive) {
await ts.activate();
}
if (css && !css.isActive) {
await css.activate();
}
if (html && !html.isActive) {
await html.activate();
}
/* from html-language-features */
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
vscode.languages.setLanguageConfiguration('astro', {
indentationRules: {
increaseIndentPattern: /<(?!\?|(?:area|base|br|col|frame|hr|html|img|input|link|meta|param)\b|[^>]*\/>)([-_\.A-Za-z0-9]+)(?=\s|>)\b[^>]*>(?!.*<\/\1>)|<!--(?!.*-->)|\{[^}"']*$/,
decreaseIndentPattern: /^\s*(<\/(?!html)[-_\.A-Za-z0-9]+\b[^>]*>|-->|\})/,
},
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
onEnterRules: [
{
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>/i,
action: { indentAction: vscode.IndentAction.IndentOutdent },
},
{
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
action: { indentAction: vscode.IndentAction.Indent },
},
],
});
}

View file

@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
},
"include": ["src"],
"exclude": ["node_modules"],
"references": [
{ "path": "../server" }
]
}

BIN
vscode/packages/server/.DS_Store vendored Normal file

Binary file not shown.

115
vscode/packages/server/package-lock.json generated Normal file
View file

@ -0,0 +1,115 @@
{
"name": "@astro-vscode/server",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"astro": {
"version": "file:../..",
"dev": true,
"requires": {
"typescript": "^4.2.3",
"vscode-languageserver": "^7.0.0"
},
"dependencies": {
"typescript": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
"dev": true
},
"vscode-jsonrpc": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz",
"integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==",
"dev": true
},
"vscode-languageserver": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz",
"integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==",
"dev": true,
"requires": {
"vscode-languageserver-protocol": "3.16.0"
}
},
"vscode-languageserver-protocol": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz",
"integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==",
"dev": true,
"requires": {
"vscode-jsonrpc": "6.0.0",
"vscode-languageserver-types": "3.16.0"
}
},
"vscode-languageserver-types": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
"integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==",
"dev": true
}
}
},
"vscode-html-languageservice": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-3.2.0.tgz",
"integrity": "sha512-aLWIoWkvb5HYTVE0kI9/u3P0ZAJGrYOSAAE6L0wqB9radKRtbJNrF9+BjSUFyCgBdNBE/GFExo35LoknQDJrfw==",
"requires": {
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-languageserver-types": "3.16.0-next.2",
"vscode-nls": "^5.0.0",
"vscode-uri": "^2.1.2"
}
},
"vscode-jsonrpc": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz",
"integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg=="
},
"vscode-languageserver": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-6.1.1.tgz",
"integrity": "sha512-DueEpkUAkD5XTR4MLYNr6bQIp/UFR0/IPApgXU3YfCBCB08u2sm9hRCs6DxYZELkk++STPjpcjksR2H8qI3cDQ==",
"requires": {
"vscode-languageserver-protocol": "^3.15.3"
}
},
"vscode-languageserver-protocol": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz",
"integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==",
"requires": {
"vscode-jsonrpc": "6.0.0",
"vscode-languageserver-types": "3.16.0"
},
"dependencies": {
"vscode-languageserver-types": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
"integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA=="
}
}
},
"vscode-languageserver-textdocument": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz",
"integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA=="
},
"vscode-languageserver-types": {
"version": "3.16.0-next.2",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.2.tgz",
"integrity": "sha512-QjXB7CKIfFzKbiCJC4OWC8xUncLsxo19FzGVp/ADFvvi87PlmBSCAtZI5xwGjF5qE0xkLf0jjKUn3DzmpDP52Q=="
},
"vscode-nls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA=="
},
"vscode-uri": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz",
"integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A=="
}
}
}

View file

@ -0,0 +1,21 @@
{
"name": "@astro-vscode/server",
"version": "0.1.0",
"author": "Skypack",
"license": "MIT",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc"
},
"devDependencies": {
"astro": "file:../../"
},
"dependencies": {
"vscode-html-languageservice": "^3.0.3",
"vscode-languageserver": "^6.1.1",
"vscode-languageserver-textdocument": "^1.0.1"
}
}

View file

@ -0,0 +1,32 @@
import { getLanguageService } from 'vscode-html-languageservice';
import { createConnection, ProposedFeatures, TextDocuments, TextDocumentSyncKind } from 'vscode-languageserver';
import { TextDocument } from 'vscode-languageserver-textdocument';
let connection = createConnection(ProposedFeatures.all);
let documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);
const htmlLanguageService = getLanguageService();
connection.onInitialize(() => {
return {
capabilities: {
textDocumentSync: TextDocumentSyncKind.Full,
completionProvider: {
resolveProvider: false,
},
},
};
});
connection.onCompletion(async (textDocumentPosition, token) => {
console.log(token);
const document = documents.get(textDocumentPosition.textDocument.uri);
if (!document) {
return null;
}
return htmlLanguageService.doComplete(document, textDocumentPosition.position, htmlLanguageService.parseHTMLDocument(document));
});
documents.listen(connection);
connection.listen();

View file

@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
},
"include": ["src"],
"exclude": ["node_modules"],
}

37
vscode/scripts/build.mjs Normal file
View file

@ -0,0 +1,37 @@
import esbuild from 'esbuild';
import config from './esbuild.config.mjs';
import { performance } from 'perf_hooks';
function buildClient() {
return esbuild.build({
...config,
entryPoints: ['packages/client/src/index.ts'],
outfile: 'dist/index.js',
});
}
function buildServer() {
return esbuild.build({
...config,
entryPoints: ['packages/server/src/index.ts'],
outfile: 'dist/server.js',
});
}
async function build() {
const start = performance.now();
try {
await Promise.all([buildClient(), buildServer()]);
} catch ({ errors }) {
if (errors[0].text.indexOf('Could not resolve') > -1) {
console.error('Make sure you run "npm run bootstrap" first!');
}
return;
}
const end = performance.now();
const span = end - start;
console.log(`✨ Built in ${Math.round(span)}ms!`);
}
build();

View file

@ -0,0 +1,7 @@
export default {
bundle: true,
logLevel: 'error',
platform: 'node',
format: 'cjs',
external: ['vscode', 'vscode-html-languageservice'],
};

27
vscode/scripts/watch.mjs Normal file
View file

@ -0,0 +1,27 @@
import esbuild from 'esbuild';
import config from './esbuild.config.mjs';
function buildClient() {
return esbuild.build({
...config,
watch: true,
entryPoints: ['packages/client/src/index.ts'],
outfile: 'dist/index.js',
});
}
function buildServer() {
return esbuild.build({
...config,
watch: true,
entryPoints: ['packages/server/src/index.ts'],
outfile: 'dist/server.js',
});
}
async function watch() {
await Promise.all([buildClient(), buildServer()]);
console.log('👀 Watching for changes...');
}
watch();

View file

@ -0,0 +1,694 @@
{
"fileTypes": [
"astro"
],
"foldingStartMarker": "(?x)\n(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl)\\b.*?>\n|<!--(?!.*--\\s*>)\n|^<!--\\ \\#tminclude\\ (?>.*?-->)$\n|<\\?(?:php)?.*\\b(if|for(each)?|while)\\b.+:\n|\\{\\{?(if|foreach|capture|literal|foreach|php|section|strip)\n|\\{\\s*($|\\?>\\s*$|\/\/|\/\\*(.*\\*\/\\s*$|(?!.*?\\*\/)))\n)",
"foldingStopMarker": "(?x)\n(<\/(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl)>\n|^(?!.*?<!--).*?--\\s*>\n|^<!--\\ end\\ tminclude\\ -->$\n|<\\?(?:php)?.*\\bend(if|for(each)?|while)\\b\n|\\{\\{?\/(if|foreach|capture|literal|foreach|php|section|strip)\n|^[^{]*\\}\n)",
"keyEquivalent": "^~H",
"name": "Astro Component",
"patterns": [
{
"include": "#astro-interpolations"
},
{
"begin": "(<)([a-zA-Z0-9:-]++)(?=[^>]*><\/\\2>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.html"
}
},
"end": "(>)(<)(\/)(\\2)(>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
},
"2": {
"name": "punctuation.definition.tag.begin.html meta.scope.between-tag-pair.html"
},
"3": {
"name": "punctuation.definition.tag.begin.html"
},
"4": {
"name": "entity.name.tag.html"
},
"5": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.tag.any.html",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"begin": "(<\\?)(xml)",
"captures": {
"1": {
"name": "punctuation.definition.tag.html"
},
"2": {
"name": "entity.name.tag.xml.html"
}
},
"end": "(\\?>)",
"name": "meta.tag.preprocessor.xml.html",
"patterns": [
{
"include": "#tag-generic-attribute"
},
{
"include": "#string-double-quoted"
},
{
"include": "#string-single-quoted"
}
]
},
{
"begin": "<!--",
"captures": [
{
"name": "punctuation.definition.comment.html"
}
],
"end": "--\\s*>",
"name": "comment.block.html",
"patterns": [
{
"match": "--",
"name": "invalid.illegal.bad-comments-or-CDATA.html"
}
]
},
{
"begin": "<!",
"captures": [
{
"name": "punctuation.definition.tag.html"
}
],
"end": ">",
"name": "meta.tag.sgml.html",
"patterns": [
{
"begin": "(?i:DOCTYPE)",
"captures": {
"1": {
"name": "entity.name.tag.doctype.html"
}
},
"end": "(?=>)",
"name": "meta.tag.sgml.doctype.html",
"patterns": [
{
"match": "\"[^\">]*\"",
"name": "string.quoted.double.doctype.identifiers-and-DTDs.html"
}
]
},
{
"begin": "\\[CDATA\\[",
"end": "]](?=>)",
"name": "constant.other.inline-data.html"
},
{
"match": "(\\s*)(?!--|>)\\S(\\s*)",
"name": "invalid.illegal.bad-comments-or-CDATA.html"
}
]
},
{
"begin": "(?:^\\s+)?(<)((?i:style))\\b(?=[^>]*lang=(['\"])css\\1?)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.style.html"
},
"3": {
"name": "punctuation.definition.tag.html"
}
},
"end": "(<\/)((?i:style))(>)(?:\\s*\\n)?",
"name": "source.css.embedded.html",
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=<\/(?i:style))",
"patterns": [
{
"include": "source.css"
}
]
}
]
},
{
"begin": "(?:^\\s+)?(<)((?i:style))\\b(?=[^>]*lang=(['\"])sass\\1?)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.style.html"
},
"3": {
"name": "punctuation.definition.tag.html"
}
},
"end": "(<\/)((?i:style))(>)(?:\\s*\\n)?",
"name": "source.sass.embedded.html",
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=<\/(?i:style))",
"patterns": [
{
"include": "source.sass"
}
]
}
]
},
{
"begin": "(?:^\\s+)?(<)((?i:style))\\b(?=[^>]*lang=(['\"])scss\\1?)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.style.html"
},
"3": {
"name": "punctuation.definition.tag.html"
}
},
"end": "(<\/)((?i:style))(>)(?:\\s*\\n)?",
"name": "source.scss.embedded.html",
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=<\/(?i:style))",
"patterns": [
{
"include": "source.css.scss"
}
]
}
]
},
{
"begin": "(?:^\\s+)?(<)((?i:style))\\b(?![^>]*\/>)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.style.html"
},
"3": {
"name": "punctuation.definition.tag.html"
}
},
"end": "(<\/)((?i:style))(>)(?:\\s*\\n)?",
"__DEFAULT_STYLE_NAME_START__": null,"name": "source.css.embedded.html","__DEFAULT_STYLE_NAME_END__": null,
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=<\/(?i:style))",
"patterns": [
{
"__DEFAULT_STYLE_INCLUDE_START__": null,"include": "source.css","__DEFAULT_STYLE_INCLUDE_END__": null
}
]
}
]
},
{
"begin": "(?:^\\s+)?(<)((?i:script))\\b(?=[^>]*lang=(['\"])tsx\\1?)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.script.html"
}
},
"end": "(?<=<\/(script|SCRIPT))(>)(?:\\s*\\n)?",
"endCaptures": {
"2": {
"name": "punctuation.definition.tag.html"
}
},
"name": "source.tsx.embedded.html",
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(?<!<\/(?:script|SCRIPT))(>)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.script.html"
}
},
"end": "(<\/)((?i:script))",
"patterns": [
{
"include": "source.tsx"
}
]
}
]
},
{
"begin": "(?:^\\s+)?(<)((?i:script))\\b(?=[^>]*lang=(['\"])ts\\1?)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.script.html"
}
},
"end": "(?<=<\/(script|SCRIPT))(>)(?:\\s*\\n)?",
"endCaptures": {
"2": {
"name": "punctuation.definition.tag.html"
}
},
"name": "source.tsx.embedded.html",
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(?<!<\/(?:script|SCRIPT))(>)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.script.html"
}
},
"end": "(<\/)((?i:script))",
"patterns": [
{
"include": "source.tsx"
}
]
}
]
},
{
"begin": "(<)((?i:script))\\b(?![^>]*\/>)(?![^>]*(?i:type.?=.?text\/((?!javascript|babel|ecmascript).*)))",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.script.html"
}
},
"end": "(?<=<\/(script|SCRIPT))(>)(?:\\s*\\n)?",
"endCaptures": {
"2": {
"name": "punctuation.definition.tag.html"
}
},
"name": "source.tsx.embedded.html",
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(?<!<\/(?:script|SCRIPT))(>)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.script.html"
}
},
"end": "(<\/)((?i:script))",
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.comment.js"
}
},
"match": "(\/\/).*?((?=<\/script)|$\\n?)",
"name": "comment.line.double-slash.js"
},
{
"begin": "\/\\*",
"captures": [
{
"name": "punctuation.definition.comment.js"
}
],
"end": "\\*\/|(?=<\/script)",
"name": "comment.block.js"
},
{
"include": "source.tsx"
}
]
}
]
},
{
"begin": "(<\/?)((?i:body|head|html)\\b)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.structure.any.html"
}
},
"end": "(>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.tag.structure.any.html",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"begin": "(<\/?)((?i:address|blockquote|dd|div|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|menu|pre)\\b)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.block.any.html"
}
},
"end": "(>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.tag.block.any.html",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"begin": "(<\/?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\\b)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.inline.any.html"
}
},
"end": "((?: ?\/)?>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.tag.inline.any.html",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"begin": "(<\/?)([a-zA-Z0-9:-]+)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.other.html"
}
},
"end": "(/?>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.tag.other.html",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"include": "#entities"
},
{
"include": "#frontmatter"
},
{
"match": "<>",
"name": "invalid.illegal.incomplete.html"
},
{
"match": "<",
"name": "invalid.illegal.bad-angle-bracket.html"
}
],
"repository": {
"frontmatter": {
"begin": "\\A-{3}\\s*$",
"contentName": "meta.embedded.block.frontmatter",
"patterns": [
{
"include": "source.tsx"
}
],
"end": "(^|\\G)-{3}|\\.{3}\\s*$"
},
"entities": {
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.entity.html"
},
"3": {
"name": "punctuation.definition.entity.html"
}
},
"match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)",
"name": "constant.character.entity.html"
},
{
"match": "&",
"name": "invalid.illegal.bad-ampersand.html"
}
]
},
"string-double-quoted": {
"begin": "\"",
"beginCaptures": [
{
"name": "punctuation.definition.string.begin.html"
}
],
"end": "\"",
"endCaptures": [
{
"name": "punctuation.definition.string.end.html"
}
],
"name": "string.quoted.double.html",
"patterns": [
{
"include": "#entities"
}
]
},
"string-single-quoted": {
"begin": "'",
"beginCaptures": [
{
"name": "punctuation.definition.string.begin.html"
}
],
"end": "'",
"endCaptures": [
{
"name": "punctuation.definition.string.end.html"
}
],
"name": "string.quoted.single.html",
"patterns": [
{
"include": "#entities"
}
]
},
"tag-generic-attribute": {
"match": "\\b([a-zA-Z\\-:]+)",
"name": "entity.other.attribute-name.html"
},
"tag-id-attribute": {
"begin": "\\b(id)\\b\\s*(=)",
"captures": {
"1": {
"name": "entity.other.attribute-name.id.html"
},
"2": {
"name": "punctuation.separator.key-value.html"
}
},
"end": "(?<='|\")",
"name": "meta.attribute-with-value.id.html",
"patterns": [
{
"begin": "\"",
"beginCaptures": [
{
"name": "punctuation.definition.string.begin.html"
}
],
"contentName": "meta.toc-list.id.html",
"end": "\"",
"endCaptures": [
{
"name": "punctuation.definition.string.end.html"
}
],
"name": "string.quoted.double.html",
"patterns": [
{
"include": "#astro-interpolations"
},
{
"include": "#entities"
}
]
},
{
"begin": "'",
"beginCaptures": [
{
"name": "punctuation.definition.string.begin.html"
}
],
"contentName": "meta.toc-list.id.html",
"end": "'",
"endCaptures": [
{
"name": "punctuation.definition.string.end.html"
}
],
"name": "string.quoted.single.html",
"patterns": [
{
"include": "#astro-interpolations"
},
{
"include": "#entities"
}
]
}
]
},
"tag-stuff": {
"patterns": [
{
"include": "#tag-id-attribute"
},
{
"include": "#tag-generic-attribute"
},
{
"include": "#string-double-quoted"
},
{
"include": "#string-single-quoted"
},
{
"include": "#astro-interpolations"
}
]
},
"astro-interpolations": {
"patterns": [
{
"begin": "\\{",
"beginCaptures": [
{
"name": "punctuation.definition.generic.begin.html"
}
],
"end": "\\}",
"endCaptures": [
{
"name": "punctuation.definition.generic.end.html"
}
],
"name": "expression.embbeded.astro",
"patterns": [
{
"include": "source.tsx"
}
]
}
]
}
},
"scopeName": "text.html.astro"
}

18
vscode/tsconfig.base.json Normal file
View file

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es2019",
"lib": ["ESNext"],
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"composite": true,
"declaration": true,
"strict": true,
"skipLibCheck": true,
"baseUrl": "./",
"paths": {
"@astro-vscode/*": ["packages/*/src"]
},
},
}

14
vscode/tsconfig.json Normal file
View file

@ -0,0 +1,14 @@
{
"extends": "./tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./packages/client"
},
{
"path": "./packages/server"
}
]
}