tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
diff --git a/src/lsp/providers/diagnosticsProvider.ts b/src/lsp/providers/diagnosticsProvider.ts
index 42609a0f4a0506c419604a51314e932673959235..aa02c0238df9d155f0e7326555cb223035219161 100644
--- a/src/lsp/providers/diagnosticsProvider.ts
+++ b/src/lsp/providers/diagnosticsProvider.ts
@@ -279,9 +279,13 @@ let base = match.groups.helper === 'theme' ? ['theme'] : []
let keys = match.groups.key.split(/[.\[\]]/).filter(Boolean)
let value = dlv(state.config, [...base, ...keys])
- // TODO: check that the type is valid
- // e.g. objects are not valid
- if (typeof value !== 'undefined') {
+ if (
+ typeof value === 'string' ||
+ typeof value === 'number' ||
+ value instanceof String ||
+ value instanceof Number ||
+ Array.isArray(value)
+ ) {
return null
}
@@ -304,7 +308,10 @@ severity:
severity === 'error'
? DiagnosticSeverity.Error
: DiagnosticSeverity.Warning,
- message: `Unknown ${match.groups.helper} key: ${match.groups.key}`,
+ message:
+ typeof value === 'undefined'
+ ? `'${match.groups.key}' does not exist in your theme config.`
+ : `'${match.groups.key}' was found but does not resolve to a string.`,
})
})
})