Merge branch 'master' into bugfix-style

master
Brad Cornes 2021-09-24 17:48:42 +01:00
commit 62ddc243d3
6 changed files with 18 additions and 10 deletions

View File

@ -2,7 +2,7 @@
"name": "@tailwindcss/language-server",
"description": "Tailwind CSS Language Server",
"license": "MIT",
"version": "0.0.3",
"version": "0.0.4",
"scripts": {
"build": "npm run clean && ncc build src/server.ts -o bin --minify && mv bin/index.js bin/tailwindcss-language-server && npm run hashbang",
"clean": "rimraf dist",

View File

@ -228,13 +228,13 @@ async function createProjectService(
let file = normalizePath(change.file)
for (let ignorePattern of ignore) {
if (minimatch(file, ignorePattern)) {
if (minimatch(file, ignorePattern, { dot: true })) {
continue
}
}
let isConfigFile = minimatch(file, `**/${CONFIG_FILE_GLOB}`)
let isPackageFile = minimatch(file, '**/package.json')
let isConfigFile = minimatch(file, `**/${CONFIG_FILE_GLOB}`, { dot: true })
let isPackageFile = minimatch(file, '**/package.json', { dot: true })
let isDependency = state.dependencies && state.dependencies.includes(change.file)
if (!isConfigFile && !isPackageFile && !isDependency) continue
@ -414,6 +414,7 @@ async function createProjectService(
onlyFiles: true,
absolute: true,
suppressErrors: true,
dot: true,
concurrency: Math.max(os.cpus().length, 1),
})
)

View File

@ -6,9 +6,7 @@ function createResolver(options: Partial<ResolveOptions> = {}): Resolver {
fileSystem: new CachedInputFileSystem(fs, 4000),
useSyncFileSystemCalls: true,
// cachePredicate: () => false,
exportsFields: [],
conditionNames: ['node'],
extensions: ['.js', '.json', '.node'],
conditionNames: ['node', 'require'],
...options,
})
}

View File

@ -40,9 +40,9 @@ function getKeywordColor(value: unknown): KeywordColor | null {
// https://github.com/khalilgharbaoui/coloregex
const colorRegex = new RegExp(
`(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?[,\\s]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys(
`(?:^|\\s|,)(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?[,\\s]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys(
colorNames
).join('|')})`,
).join('|')})(?:$|\\s|,)`,
'gi'
)
@ -52,7 +52,12 @@ function getColorsInString(str: string): (TinyColor | KeywordColor)[] {
return (
str
.match(colorRegex)
?.map((color) => color.replace(/var\([^)]+\)/, '1'))
?.map((color) =>
color
.trim()
.replace(/^,|,$/g, '')
.replace(/var\([^)]+\)/, '1')
)
.map((color) => getKeywordColor(color) ?? new TinyColor(color))
.filter((color) => (color instanceof TinyColor ? color.isValid : true)) ?? []
)

View File

@ -24,6 +24,7 @@ export const htmlLanguages = [
'mustache',
'njk',
'nunjucks',
'phoenix-heex',
'php',
'razor',
'slim',

View File

@ -39,6 +39,9 @@
"onStartupFinished"
],
"main": "dist/extension/index.js",
"capabilities": {
"virtualWorkspaces": false
},
"contributes": {
"commands": [
{