Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
d.parent.nodes!.find(n => {
return (
(n as postcss.Declaration).prop === valueMapping.from &&
path.resolve(
path.dirname(scannedMeta.source),
(n as postcss.Declaration).value.replace(/"/g, '')
) === defMeta.source
);
})
) {
provide({
parentSelector,
meta,
fullLineText,
lineChunkAtCursor,
position,
fs,
tsLangService,
stylable
}: ProviderOptions): Completion[] {
if (
meta.imports.some(
imp => imp.fromRelative.endsWith('.ts') || imp.fromRelative.endsWith('.js')
) &&
!fullLineText.trim().startsWith(valueMapping.from) &&
parentSelector &&
lineChunkAtCursor.startsWith(valueMapping.mixin + ':')
) {
if (fullLineText.lastIndexOf('(') > fullLineText.lastIndexOf(')')) {
return [];
}
const { lastName } = getExistingNames(fullLineText, position);
return Object.keys(meta.mappedSymbols)
.filter(ms => meta.mappedSymbols[ms]._kind === 'import')
.filter(ms => ms.startsWith(lastName))
.filter(ms => {
const res = stylable.resolver.resolve(meta.mappedSymbols[ms]);
return res && res._kind === 'js';
})
.filter(ms => isMixin(ms, meta, fs, tsLangService))
provide({
meta,
fullLineText,
parentSelector,
lineChunkAtCursor,
position,
fs,
tsLangService,
stylable
}: ProviderOptions): Completion[] {
if (
meta.imports.some(
imp => imp.fromRelative.endsWith('.ts') || imp.fromRelative.endsWith('.js')
) &&
!fullLineText.trim().startsWith(valueMapping.from) &&
!fullLineText.trim().startsWith(valueMapping.extends) &&
!fullLineText.trim().startsWith(valueMapping.named) &&
parentSelector &&
~fullLineText.indexOf(':') &&
fullLineText.indexOf(':') < position.character &&
!lineChunkAtCursor.startsWith(valueMapping.mixin + ':')
) {
const { lastName } = getExistingNames(fullLineText, position);
return (
Object.keys(meta.mappedSymbols)
.filter(ms => meta.mappedSymbols[ms]._kind === 'import')
.filter(ms => ms.startsWith(lastName))
.filter(ms => {
const res = stylable.resolver.resolve(meta.mappedSymbols[ms]);
return res && res._kind === 'js';
})