Skip to content
This repository was archived by the owner on Aug 25, 2020. It is now read-only.

Commit 8c7a4df

Browse files
author
Chris Ward
committed
Merge branch 'master' of github.com:testthedocs/vscode-vale
2 parents cf1d02e + fa1cdfd commit 8c7a4df

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,30 @@ Vale automatically checks a document when you open or save it. Use the `Vale: L
2626

2727
Vale always runs from the workspace directory in either case, so if you put a [Vale configuration][config] in the workspace directory it will automatically pick it up.
2828

29-
This extension supports:
29+
This extension supports the following file extensions by default, but you can change them with the `vscode-vale.fileExtensions` config item (see below):
3030

3131
- **Asciidoc**: _.adoc_ and _.asciidoc_
3232
- **Markdown**: _.md_ and _.markdown_
3333
- **reStructuredText**: _.rst_
3434
- **LaTeX**: _.tex_
3535
- **plain text**: _.txt_
3636

37-
[Open an issue][issue] or a pull request if you need support for **more document formats**, provided that [Vale][] supports them.
38-
3937
[config]: https://errata-ai.github.io/vale/config/
4038

4139
## Configuration
4240

43-
- `vscode-vale.path`: (default `vale`). Absolute path to the `vale` binary, useful if you don't want to use the global binary.
41+
- `vscode-vale.path`: (default `vale`). Absolute path to the `vale` binary, useful if you don't want to use the global binary.
42+
43+
**Example**
44+
45+
```js
46+
{
47+
// You can use ${workspaceFolder} it will be replaced by workspace folder path
48+
"vscode-vale.path": "${workspaceFolder}/node_modules/.bin/vale"
4449

45-
**Example**
46-
```js
47-
{
48-
// You can use ${workspaceFolder} it will be replaced by workspace folder path
49-
"vscode-vale.path": "${workspaceFolder}/node_modules/.bin/vale"
50+
// or use some absolute path
51+
"vscode-vale.path": "/some/path/to/vale"
52+
}
53+
```
5054

51-
// or use some absolute path
52-
"vscode-vale.path": "/some/path/to/vale"
53-
}
54-
```
55+
- `vscode-vale.fileExtensions`: (default `md, markdown, txt, rst, tex, adoc, asciidoc`). File extensions to lint. Note, these also need to be in your Vale config file.

package.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,24 @@
6060
"type": "string",
6161
"default": "vale",
6262
"description": "Absolute path to Vale binary. Special var ${workspaceFolder} can be used in path (NOTE: in windows you can use '/' and can omit '.cmd' in path)"
63-
}
63+
},
64+
"vscode-vale.fileExtensions": {
65+
"scope": "resource",
66+
"type": "array",
67+
"default": [
68+
"md",
69+
"markdown",
70+
"txt",
71+
"rst",
72+
"tex",
73+
"adoc",
74+
"asciidoc"
75+
],
76+
"description": "File extensions to lint. Note, these also need to be in your Vale config file.",
77+
"items": {
78+
"type": "string"
79+
}
80+
},
6481
}
6582
}
6683
},

src/extension.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,15 +357,11 @@ const runValeOnWorkspace = async (): Promise<ValeDiagnostics> => {
357357
// Explicitly find all elligible files ourselves so that we respect
358358
// "files.exclude", ie, only look at files that are included in the
359359
// workspace.
360-
const extensions: ReadonlyArray<string> = [
361-
"md",
362-
"markdown",
363-
"txt",
364-
"rst",
365-
"tex",
366-
"adoc",
367-
"asciidoc",
368-
];
360+
361+
const extensions = workspace
362+
.getConfiguration("vscode-vale")
363+
.get<ReadonlyArray<string>>("fileExtensions")!;
364+
369365
const pattern = `**/*.{${extensions.join(",")}}`;
370366
const uris = await workspace.findFiles(pattern);
371367
const results: ValeDiagnostics = new Map();

0 commit comments

Comments
 (0)