Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Jul 18, 2023
1 parent a1f23dd commit 43f9d6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,19 +451,21 @@ export async function activate(context: vscode.ExtensionContext) {
...['class', 'className', 'id', 'style'].map(item => createCompletionItem({ content: item, snippet: `${item}="$1"`, type: 5 })),
...completions
.map(([content, detail, colorInfo]: any) => {
const documentation = new vscode.MarkdownString()
documentation.appendCodeblock(detail, 'css')

if (colorInfo) {
const { color, opacity } = colorInfo
let documentation = colors[color]
if (opacity) {
const rgb = hex2RGB(documentation)
documentation = `rgba(${rgb?.join(',')},${opacity / 100})`
const rgb = hex2RGB(colors[color])
return createCompletionItem({ content, detail: `rgba(${rgb?.join(',')},${opacity / 100})`, type: vscode.CompletionItemKind.Color, documentation })
}
return createCompletionItem({ content, detail, type: vscode.CompletionItemKind.Color, documentation })
return createCompletionItem({ content, detail: colors[color], type: vscode.CompletionItemKind.Color, documentation })
}
if (content.startsWith('animate'))
return createCompletionItem({ content, detail, type: vscode.CompletionItemKind.Unit })
return createCompletionItem({ content, documentation, type: vscode.CompletionItemKind.Unit })

return createCompletionItem({ content, detail, type: vscode.CompletionItemKind.Enum })
return createCompletionItem({ content, documentation, type: vscode.CompletionItemKind.Enum })
})]
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const suppleMore = [
]

const customMap = [
['flex-center', 'justify-center items-center'],
['flex-center', 'flex justify-center items-center'],
['pointer', 'cursor-pointer'],
['maxw', 'max-w'],
['minw', 'min-w'],
Expand Down

0 comments on commit 43f9d6d

Please sign in to comment.