add missing document types

master
Brad Cornes 2018-08-21 11:58:19 +01:00
parent c063e3f17e
commit f256aa5176
1 changed files with 22 additions and 20 deletions

View File

@ -7,6 +7,24 @@ const dlv = require('dlv')
const Color = require('color') const Color = require('color')
const CONFIG_GLOB = '{tailwind,tailwind.config,tailwind-config,.tailwindrc}.js' const CONFIG_GLOB = '{tailwind,tailwind.config,tailwind-config,.tailwindrc}.js'
const JS_TYPES = ['typescriptreact', 'javascript', 'javascriptreact']
const HTML_TYPES = [
'html',
'jade',
'razor',
'php',
'blade',
'vue',
'twig',
'markdown',
'erb',
'handlebars',
'ejs',
'nunjucks',
// for jsx
...JS_TYPES
]
const CSS_TYPES = ['css', 'sass', 'scss', 'less', 'postcss', 'stylus']
export async function activate(context: vscode.ExtensionContext) { export async function activate(context: vscode.ExtensionContext) {
let tw let tw
@ -286,7 +304,7 @@ class TailwindIntellisense {
this._providers.push( this._providers.push(
createCompletionItemProvider( createCompletionItemProvider(
this._items, this._items,
['typescriptreact', 'javascript', 'javascriptreact'], JS_TYPES,
/\btw`([^`]*)$/, /\btw`([^`]*)$/,
['`', ' ', separator], ['`', ' ', separator],
tailwind.config tailwind.config
@ -296,7 +314,7 @@ class TailwindIntellisense {
this._providers.push( this._providers.push(
createCompletionItemProvider( createCompletionItemProvider(
this._items, this._items,
['css', 'sass', 'scss'], CSS_TYPES,
/@apply ([^;}]*)$/, /@apply ([^;}]*)$/,
['.', separator], ['.', separator],
tailwind.config, tailwind.config,
@ -307,23 +325,7 @@ class TailwindIntellisense {
this._providers.push( this._providers.push(
createCompletionItemProvider( createCompletionItemProvider(
this._items, this._items,
[ HTML_TYPES,
'html',
'jade',
'razor',
'php',
'blade',
'vue',
'twig',
'markdown',
'erb',
'handlebars',
'ejs',
// for jsx
'typescriptreact',
'javascript',
'javascriptreact'
],
/\bclass(Name)?=["']([^"']*)$/, // /\bclass(Name)?=(["'])(?!.*?\2)/ /\bclass(Name)?=["']([^"']*)$/, // /\bclass(Name)?=(["'])(?!.*?\2)/
["'", '"', ' ', separator], ["'", '"', ' ', separator],
tailwind.config tailwind.config
@ -372,7 +374,7 @@ class TailwindIntellisense {
) )
this._providers.push( this._providers.push(
vscode.languages.registerHoverProvider('html', { vscode.languages.registerHoverProvider(HTML_TYPES, {
provideHover: (document, position, token) => { provideHover: (document, position, token) => {
const range1: vscode.Range = new vscode.Range( const range1: vscode.Range = new vscode.Range(
new vscode.Position(Math.max(position.line - 5, 0), 0), new vscode.Position(Math.max(position.line - 5, 0), 0),