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

View File

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

View File

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

View File

@ -40,9 +40,9 @@ function getKeywordColor(value: unknown): KeywordColor | null {
// https://github.com/khalilgharbaoui/coloregex // https://github.com/khalilgharbaoui/coloregex
const colorRegex = new RegExp( 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 colorNames
).join('|')})`, ).join('|')})(?:$|\\s|,)`,
'gi' 'gi'
) )
@ -52,7 +52,12 @@ function getColorsInString(str: string): (TinyColor | KeywordColor)[] {
return ( return (
str str
.match(colorRegex) .match(colorRegex)
?.map((color) => color.replace(/var\([^)]+\)/, '1')) ?.map((color) =>
color
.trim()
.replace(/^,|,$/g, '')
.replace(/var\([^)]+\)/, '1')
)
.map((color) => getKeywordColor(color) ?? new TinyColor(color)) .map((color) => getKeywordColor(color) ?? new TinyColor(color))
.filter((color) => (color instanceof TinyColor ? color.isValid : true)) ?? [] .filter((color) => (color instanceof TinyColor ? color.isValid : true)) ?? []
) )

View File

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

View File

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