Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Nov 4, 2023
1 parent 0b4417d commit 01c4668
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/language-service/src/providers/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ function parseColorString(colorString: string, theme: string, css: MasterCSS = n
let colorAlpha = 1
let colorName = colorString
const allCSSColorNames = []
for (const eachVariableName of css.variables) {
// todo: refactor css.variables
for (const eachVariableName in css.variables) {
const eachVariable = css.variables[eachVariableName]
if (eachVariable.type === 'color')
allCSSColorNames.push(eachVariable.name)
allCSSColorNames.push(eachVariableName)
}
if (colorString.split('/').length == 2) {
colorAlpha = Number('0' + colorString.split('/')[1])
Expand Down
6 changes: 3 additions & 3 deletions packages/language-service/src/providers/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,14 @@ function getColorsItem(css: MasterCSS = new MasterCSS()): CompletionItem[] {
const masterStyleCompletionItem: CompletionItem[] = []

// todo: refactor css.variables
for (const eachVariableName of css.variables) {
for (const eachVariableName in css.variables) {
const eachVariable = css.variables[eachVariableName]
if (eachVariable.type === 'color') {
masterStyleCompletionItem.push({
label: eachVariable.name,
label: eachVariableName,
documentation: eachVariable.value,
kind: 16,
sortText: `${eachVariable.name}`
sortText: eachVariableName
})
}
}
Expand Down

0 comments on commit 01c4668

Please sign in to comment.