Skip to content

Commit 043fe52

Browse files
authored
Merge pull request zignd#100 from pungggi/globPatterns
Glob patterns
2 parents 4356d0d + cff67ef commit 043fe52

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ You can request new features and/or contribute to the extension development on i
3636
Check out the [change log](https://github.com/zignd/HTML-CSS-Class-Completion/blob/master/CHANGELOG.md) for the current and previous updates.
3737

3838
## Usage
39-
If there are HTML files on your workspace, the extension automatically starts and looks for CSS class definitions. In case new CSS classes are defined or new CSS files are added to the workspace and you also want auto completion for them, simply hit the lightning icon on the status bar and execute the command by pressing `Ctrl+Shift+P`(`cmd+Shift+P` for Mac) and then typing "Cache CSS class definitions".
39+
If there are HTML or JS files on your workspace, the extension automatically starts and looks for CSS class definitions. In case new CSS classes are defined or new CSS files are added to the workspace and you also want auto completion for them, simply hit the lightning icon on the status bar and execute the command by pressing `Ctrl+Shift+P`(`cmd+Shift+P` for Mac) and then typing "Cache CSS class definitions".
40+
41+
You can omit or exclusively include the folders to search for by using these configurations:
42+
`css-class-completion.includeGlobPattern` or `css-class-completion.excludeGlobPattern`.
4043

4144
![](https://i.imgur.com/O7NjEUW.gif)
4245
![](https://i.imgur.com/uyiXqMb.gif)

package.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@
2727
"command": "html-css-class-completion.cache",
2828
"title": "Cache CSS class definitions"
2929
}
30+
],
31+
"configuration": [
32+
{
33+
"title": "CSS Class Completion",
34+
"properties": {
35+
"html-css-class-completion.includeGlobPattern": {
36+
"type": "string",
37+
"default": "**/*.{css,html}",
38+
"description": "A glob pattern that defines files and folders to search for. The glob pattern will be matched against the paths of resulting matches relative to their workspace."
39+
},
40+
"html-css-class-completion.excludeGlobPattern": {
41+
"type": "string",
42+
"default": "",
43+
"description": "A glob pattern that defines files and folders to exclude. The glob pattern will be matched against the file paths of resulting matches relative to their workspace."
44+
}
45+
}
46+
}
3047
]
3148
},
3249
"icon": "images/icon.png",
@@ -60,4 +77,4 @@
6077
"request": "^2.81.0",
6178
"request-promise": "^4.2.1"
6279
}
63-
}
80+
}

src/fetcher.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import ParseEngineRegistry from './parse-engines/parse-engine-registry';
33

44
class Fetcher {
55
static async findAllParseableDocuments(): Promise<vscode.Uri[]> {
6-
const languages = ParseEngineRegistry.supportedLanguagesIds.join(',');
6+
const includeGlobPattern = vscode.workspace.getConfiguration().get('html-css-class-completion.includeGlobPattern');
7+
const excludeGlobPattern = vscode.workspace.getConfiguration().get('html-css-class-completion.excludeGlobPattern');
78

8-
return await vscode.workspace.findFiles(`**/*.{${languages}}`, '');
9+
return await vscode.workspace.findFiles(`${includeGlobPattern}`, `${excludeGlobPattern}`);
910
}
1011
}
1112

0 commit comments

Comments
 (0)