Skip to content

Commit 0ba9419

Browse files
committed
infra: add prettier
1 parent fd2ccfe commit 0ba9419

10 files changed

+188
-92
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
coverage/
2+
dist/
3+
CHANGELOG.md
4+
pnpm-lock.yaml

.prettierrc.cjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
3+
/**
4+
* @type {import('prettier').Options}
5+
*/
6+
module.exports = {
7+
plugins: [require.resolve('prettier-plugin-organize-imports')],
8+
singleQuote: true,
9+
overrides: [
10+
{
11+
files: '*.json5',
12+
options: {
13+
parser: 'json5',
14+
quoteProps: 'preserve',
15+
singleQuote: false,
16+
trailingComma: 'none',
17+
},
18+
},
19+
],
20+
};

.vscode/launch.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
{
6-
"version": "0.2.0",
7-
"configurations": [
8-
{
9-
"name": "Extension",
10-
"type": "extensionHost",
11-
"request": "launch",
12-
"args": [
13-
"--extensionDevelopmentPath=${workspaceFolder}"
14-
]
15-
}
16-
]
17-
}
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"]
13+
}
14+
]
15+
}

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ For example:
2424

2525
This extension contributes the following settings:
2626

27-
* `myExtension.enable`: Enable/disable this extension.
28-
* `myExtension.thing`: Set to `blah` to do something.
27+
- `myExtension.enable`: Enable/disable this extension.
28+
- `myExtension.thing`: Set to `blah` to do something.
2929

3030
## Known Issues
3131

@@ -53,13 +53,13 @@ Added features X, Y, and Z.
5353

5454
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
5555

56-
* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
57-
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
58-
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
56+
- Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
57+
- Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
58+
- Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
5959

6060
## For more information
6161

62-
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
63-
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
62+
- [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
63+
- [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
6464

6565
**Enjoy!**

language-configuration.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
2-
"comments": {
3-
// symbol used for single line comment. Remove this entry if your language does not support line comments
4-
"lineComment": "//",
5-
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6-
"blockComment": [ "/*", "*/" ]
7-
},
8-
// symbols used as brackets
9-
"brackets": [
10-
["{", "}"],
11-
["[", "]"],
12-
["(", ")"]
13-
],
14-
// symbols that are auto closed when typing
15-
"autoClosingPairs": [
16-
["{", "}"],
17-
["[", "]"],
18-
["(", ")"],
19-
["\"", "\""],
20-
["'", "'"]
21-
],
22-
// symbols that can be used to surround a selection
23-
"surroundingPairs": [
24-
["{", "}"],
25-
["[", "]"],
26-
["(", ")"],
27-
["\"", "\""],
28-
["'", "'"]
29-
]
30-
}
2+
"comments": {
3+
// symbol used for single line comment. Remove this entry if your language does not support line comments
4+
"lineComment": "//",
5+
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6+
"blockComment": ["/*", "*/"]
7+
},
8+
// symbols used as brackets
9+
"brackets": [
10+
["{", "}"],
11+
["[", "]"],
12+
["(", ")"]
13+
],
14+
// symbols that are auto closed when typing
15+
"autoClosingPairs": [
16+
["{", "}"],
17+
["[", "]"],
18+
["(", ")"],
19+
["\"", "\""],
20+
["'", "'"]
21+
],
22+
// symbols that can be used to surround a selection
23+
"surroundingPairs": [
24+
["{", "}"],
25+
["[", "]"],
26+
["(", ")"],
27+
["\"", "\""],
28+
["'", "'"]
29+
]
30+
}

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"displayName": "hsml",
44
"description": "hsml support for Visual Studio Code",
55
"version": "0.1.0",
6+
"scripts": {
7+
"format": "prettier --cache --write ."
8+
},
69
"engines": {
710
"vscode": "^1.78.0"
811
},
@@ -29,5 +32,10 @@
2932
"path": "./syntaxes/hsml.tmLanguage.json"
3033
}
3134
]
35+
},
36+
"devDependencies": {
37+
"@types/node": "~20.2.5",
38+
"prettier": "~2.8.8",
39+
"prettier-plugin-organize-imports": "~3.2.2"
3240
}
3341
}

pnpm-lock.yaml

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

syntaxes/hsml.tmLanguage.json

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3-
"name": "hsml",
4-
"patterns": [
5-
{
6-
"include": "#keywords"
7-
},
8-
{
9-
"include": "#strings"
10-
}
11-
],
12-
"repository": {
13-
"keywords": {
14-
"patterns": [{
15-
"name": "keyword.control.hsml",
16-
"match": "\\b(if|while|for|return)\\b"
17-
}]
18-
},
19-
"strings": {
20-
"name": "string.quoted.double.hsml",
21-
"begin": "\"",
22-
"end": "\"",
23-
"patterns": [
24-
{
25-
"name": "constant.character.escape.hsml",
26-
"match": "\\\\."
27-
}
28-
]
29-
}
30-
},
31-
"scopeName": "index.hsml"
32-
}
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "hsml",
4+
"patterns": [
5+
{
6+
"include": "#keywords"
7+
},
8+
{
9+
"include": "#strings"
10+
}
11+
],
12+
"repository": {
13+
"keywords": {
14+
"patterns": [
15+
{
16+
"name": "keyword.control.hsml",
17+
"match": "\\b(if|while|for|return)\\b"
18+
}
19+
]
20+
},
21+
"strings": {
22+
"name": "string.quoted.double.hsml",
23+
"begin": "\"",
24+
"end": "\"",
25+
"patterns": [
26+
{
27+
"name": "constant.character.escape.hsml",
28+
"match": "\\\\."
29+
}
30+
]
31+
}
32+
},
33+
"scopeName": "index.hsml"
34+
}

vsc-extension-quickstart.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
## What's in the folder
44

5-
* This folder contains all of the files necessary for your extension.
6-
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
7-
* `syntaxes/hsml.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
8-
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
5+
- This folder contains all of the files necessary for your extension.
6+
- `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
7+
- `syntaxes/hsml.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
8+
- `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
99

1010
## Get up and running straight away
1111

12-
* Make sure the language configuration settings in `language-configuration.json` are accurate.
13-
* Press `F5` to open a new window with your extension loaded.
14-
* Create a new file with a file name suffix matching your language.
15-
* Verify that syntax highlighting works and that the language configuration settings are working.
12+
- Make sure the language configuration settings in `language-configuration.json` are accurate.
13+
- Press `F5` to open a new window with your extension loaded.
14+
- Create a new file with a file name suffix matching your language.
15+
- Verify that syntax highlighting works and that the language configuration settings are working.
1616

1717
## Make changes
1818

19-
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
20-
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
19+
- You can relaunch the extension from the debug toolbar after making changes to the files listed above.
20+
- You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
2121

2222
## Add more language features
2323

24-
* To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
24+
- To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
2525

2626
## Install your extension
2727

28-
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
29-
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.
28+
- To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
29+
- To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

0 commit comments

Comments
 (0)