Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Mar 29, 2024
1 parent 67ebfa4 commit d25652b
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 29 deletions.
5 changes: 4 additions & 1 deletion packages/tailwindcss-language-server/package.json
Expand Up @@ -25,7 +25,10 @@
"bin": {
"tailwindcss-language-server": "./bin/tailwindcss-language-server"
},
"files": ["bin", "ThirdPartyNotices.txt"],
"files": [
"bin",
"ThirdPartyNotices.txt"
],
"publishConfig": {
"access": "public"
},
Expand Down
Expand Up @@ -12,9 +12,7 @@ const resolveImports = postcss([
postcssImport({
resolve(id, basedir) {
let paths = resolver.resolveSync({}, basedir, id)
return paths
? paths
: id
return paths ? paths : id
},
}),
])
Expand Down
Expand Up @@ -571,7 +571,9 @@ withFixture('v4/workspaces', (c) => {
result.items.find((item) => item.label === 'bg-style-main'),
]

let resolved = await Promise.all(items.map((item) => c.sendRequest('completionItem/resolve', item)))
let resolved = await Promise.all(
items.map((item) => c.sendRequest('completionItem/resolve', item)),
)

expect(resolved[0]).toEqual({
...items[0],
Expand Down
@@ -1,3 +1,3 @@
@theme {
--color-beet: #8e3b46;
--color-beet: #8e3b46;
}
@@ -1,3 +1,3 @@
@theme {
--color-orangepeel: #ff9f00;
--color-orangepeel: #ff9f00;
}
@@ -1,3 +1,3 @@
@theme {
--color-style-main: #8e3b46;
--color-style-main: #8e3b46;
}
Expand Up @@ -28,7 +28,8 @@ export function validateConfigPath(
let suggestions: string[] = []

// This property may not exist in the state object because of compatability with Tailwind Play
let transformThemeValue = state.modules?.transformThemeValue?.module ?? ((_: any) => (value: any) => value)
let transformThemeValue =
state.modules?.transformThemeValue?.module ?? ((_: any) => (value: any) => value)

if (fullPath[0] === 'theme' && fullPath[1]) {
value = transformThemeValue(fullPath[1])(value)
Expand Down
6 changes: 5 additions & 1 deletion packages/tailwindcss-language-service/src/hoverProvider.ts
Expand Up @@ -23,7 +23,11 @@ export async function doHover(
)
}

async function provideCssHelperHover(state: State, document: TextDocument, position: Position): Promise<Hover> {
async function provideCssHelperHover(
state: State,
document: TextDocument,
position: Position,
): Promise<Hover> {
if (!isCssContext(state, document, position)) {
return null
}
Expand Down
7 changes: 3 additions & 4 deletions packages/tailwindcss-language-service/src/util/css.ts
Expand Up @@ -7,9 +7,9 @@ import { cssLanguages } from './languages'
import { getLanguageBoundaries } from './getLanguageBoundaries'

function getCssLanguages(state: State) {
const userCssLanguages = Object
.keys(state.editor.userLanguages)
.filter((lang) => cssLanguages.includes(state.editor.userLanguages[lang]))
const userCssLanguages = Object.keys(state.editor.userLanguages).filter((lang) =>
cssLanguages.includes(state.editor.userLanguages[lang]),
)

return [...cssLanguages, ...userCssLanguages]
}
Expand All @@ -18,7 +18,6 @@ export function isCssLanguage(state: State, lang: string) {
return getCssLanguages(state).indexOf(lang) !== -1
}


export function isCssDoc(state: State, doc: TextDocument): boolean {
return isCssLanguage(state, doc.languageId)
}
Expand Down
30 changes: 16 additions & 14 deletions packages/tailwindcss-language-service/src/util/find.ts
Expand Up @@ -419,24 +419,26 @@ export async function findClassNameAtPosition(
if (isVueDoc(doc)) {
let boundaries = getLanguageBoundaries(state, doc)

let groups = await Promise.all(boundaries.map(async ({ type, range, lang }) => {
if (type === 'css') {
return findClassListsInCssRange(state, doc, range, lang)
}
let groups = await Promise.all(
boundaries.map(async ({ type, range, lang }) => {
if (type === 'css') {
return findClassListsInCssRange(state, doc, range, lang)
}

if (type === 'html') {
return await findClassListsInHtmlRange(state, doc, 'html', range)
}
if (type === 'html') {
return await findClassListsInHtmlRange(state, doc, 'html', range)
}

if (type === 'jsx') {
return await findClassListsInHtmlRange(state, doc, 'jsx', range)
}
if (type === 'jsx') {
return await findClassListsInHtmlRange(state, doc, 'jsx', range)
}

return []
}))
return []
}),
)

classNames = dedupeByRange(flatten(groups)).flatMap(
(classList) => getClassNamesInClassList(classList, state.blocklist)
classNames = dedupeByRange(flatten(groups)).flatMap((classList) =>
getClassNamesInClassList(classList, state.blocklist),
)
} else if (isCssContext(state, doc, position)) {
classNames = await findClassNamesInRange(state, doc, searchRange, 'css')
Expand Down
Expand Up @@ -10,7 +10,7 @@ import { getTextWithoutComments } from './doc'
import { isCssLanguage } from './css'

export type LanguageBoundary = {
type: 'html' | 'js' | 'jsx' | 'css' | (string & {});
type: 'html' | 'js' | 'jsx' | 'css' | (string & {})
range: Range
lang?: string
}
Expand Down

0 comments on commit d25652b

Please sign in to comment.