Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
grammars/css.tmLanguage.json
testing-util/example.css
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"${workspaceFolder}/testing-util/example.css",
"--extensionDevelopmentPath=${workspaceFolder}"
],
"preLaunchTask": "prepare-extension-debugging"
}
]
}
11 changes: 11 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "prepare-extension-debugging",
"type": "npm",
"script": "prepare-extension-debugging",
"isBackground": false,
},
]
}
28 changes: 28 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"comments": {
// symbols used for start and end a block comment.
"blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
3 changes: 3 additions & 0 deletions package-lock.json

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

26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,37 @@
"description": "CSS support in VS Code",
"version": "0.0.0",
"scripts": {
"prepare-extension-debugging": "node ./testing-util/prepare-extension-debugging.mjs ",
"test": "node --test ./spec/css-spec.mjs"
},
"devDependencies": {
"cson": "^8.2.0",
"vscode-oniguruma": "^2.0.1",
"vscode-textmate": "^9.0.0"
},
"engines": {
"vscode": "^1.96.0"
},
"contributes": {
"languages": [
{
"id": "css",
"aliases": [
"CSS",
"css"
],
"extensions": [
".css"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "css",
"scopeName": "source.css",
"path": "./grammars/css.tmLanguage.json"
}
]
}
}
14 changes: 14 additions & 0 deletions testing-util/prepare-extension-debugging.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import fs from 'fs';
import path from 'path';
import cson from 'cson';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const file = await fs.promises.readFile(path.join(__dirname, '..', 'grammars', 'css.cson'));
await fs.promises.writeFile(path.join(__dirname, '..', 'grammars', 'css.tmLanguage.json'), cson.createJSONString(cson.parse(file.toString())));

if (!fs.existsSync(path.join(__dirname, '..', 'testing-util', 'example.css'))) {
await fs.promises.writeFile(path.join(__dirname, '..', 'testing-util', 'example.css'), `.foo {\n\tcolor: lime;\n}\n`);
}