-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for a bunch of file types
- Loading branch information
1 parent
77508a1
commit 850826c
Showing
3 changed files
with
119 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Borrowed from https://github.com/zignd/HTML-CSS-Class-Completion/blob/master/src/extension.ts | ||
|
||
const classRegex = /class=["|']([\w- ]*$)/ | ||
const classNameRegex = /className=["|']([\w- ]*$)/ | ||
const applyRegex = /@apply ([\.\w- ]*$)/ | ||
const emmetRegex = /(?=\.)([\w-\. ]*$)/ | ||
|
||
const jsPatterns = [ | ||
{ | ||
regex: classRegex, | ||
splitCharacter: ' ' | ||
}, | ||
{ | ||
regex: classNameRegex, | ||
splitCharacter: ' ' | ||
}, | ||
{ | ||
regex: emmetRegex, | ||
splitCharacter: '.' | ||
} | ||
] | ||
|
||
const htmlPatterns = [ | ||
{ | ||
regex: classRegex, | ||
splitCharacter: ' ' | ||
}, | ||
{ | ||
regex: emmetRegex, | ||
splitCharacter: '.' | ||
} | ||
] | ||
|
||
const stylesPatterns = [ | ||
{ | ||
regex: applyRegex, | ||
splitCharacter: ' ' | ||
} | ||
] | ||
|
||
const fileTypes = [ | ||
{ | ||
extension: 'javascript', | ||
patterns: jsPatterns | ||
}, | ||
{ | ||
extension: 'javascriptreact', | ||
patterns: jsPatterns | ||
}, | ||
{ | ||
extension: 'typescriptreact', | ||
patterns: jsPatterns | ||
}, | ||
{ | ||
extension: 'html', | ||
patterns: htmlPatterns | ||
}, | ||
{ | ||
extension: 'php', | ||
patterns: htmlPatterns | ||
}, | ||
{ | ||
extension: 'vue', | ||
patterns: htmlPatterns | ||
}, | ||
{ | ||
extension: 'css', | ||
patterns: stylesPatterns | ||
}, | ||
{ | ||
extension: 'scss', | ||
patterns: stylesPatterns | ||
} | ||
] | ||
|
||
module.exports = fileTypes |