Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
typeToKind(type: ?string, description: ?string): CompletionItemKindType {
if (type === 'function') {
return CompletionItemKind.Function;
}
if (description && description.indexOf('[class: ') >= 0) {
return CompletionItemKind.Class;
}
return CompletionItemKind.Variable;
}
}
provider.collectAttributes(tag, (attribute, type, documentation) => {
if ((type === 'event' && filterPrefix !== '@') || (type !== 'event' && filterPrefix === '@')) {
return;
}
let codeSnippet = attribute;
if (type !== 'v' && value.length) {
codeSnippet = codeSnippet + value;
}
result.items.push({
label: attribute,
kind: type === 'event' ? CompletionItemKind.Function : CompletionItemKind.Value,
textEdit: TextEdit.replace(range, codeSnippet),
insertTextFormat: InsertTextFormat.Snippet,
sortText: priority + attribute,
documentation
});
});
});
SCSSCompletion.prototype.getCompletionsForExtendsReference = function (extendsRef, existingNode, result) {
var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, nodes.ReferenceType.Rule);
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var suggest = {
label: symbol.name,
textEdit: TextEdit.replace(this.getCompletionRange(existingNode), symbol.name),
kind: CompletionItemKind.Function,
};
result.items.push(suggest);
}
return result;
};
SCSSCompletion.prototype.getCompletionForAtDirectives = function (result) {
typeToKind(type: ?string, description: ?string): CompletionItemKindType {
if (type === 'function') {
return CompletionItemKind.Function;
}
if (description && description.indexOf('[class: ') >= 0) {
return CompletionItemKind.Class;
}
return CompletionItemKind.Variable;
}
}
case 'primitive type':
case 'keyword':
return CompletionItemKind.Keyword;
case 'var':
case 'local var':
return CompletionItemKind.Variable;
case 'property':
case 'getter':
case 'setter':
return CompletionItemKind.Field;
case 'function':
case 'method':
case 'construct':
case 'call':
case 'index':
return CompletionItemKind.Function;
case 'enum':
return CompletionItemKind.Enum;
case 'module':
return CompletionItemKind.Module;
case 'class':
return CompletionItemKind.Class;
case 'interface':
return CompletionItemKind.Interface;
case 'warning':
return CompletionItemKind.File;
}
return CompletionItemKind.Property;
}
case 'primitive type':
case 'keyword':
return CompletionItemKind.Keyword;
case 'var':
case 'local var':
return CompletionItemKind.Variable;
case 'property':
case 'getter':
case 'setter':
return CompletionItemKind.Field;
case 'function':
case 'method':
case 'construct':
case 'call':
case 'index':
return CompletionItemKind.Function;
case 'enum':
return CompletionItemKind.Enum;
case 'module':
return CompletionItemKind.Module;
case 'class':
return CompletionItemKind.Class;
case 'interface':
return CompletionItemKind.Interface;
case 'warning':
return CompletionItemKind.File;
}
return CompletionItemKind.Property;
}
export default builtIn.map((item) => {
const completionItem = CompletionItem.create(item.insertText);
completionItem.detail = item.name;
completionItem.insertText = item.insertText;
completionItem.documentation = item.desc;
completionItem.kind = CompletionItemKind.Function;
return completionItem;
});
buildInfunctionsMap.forEach((value, key) => {
const item = {
label: key,
kind: CompletionItemKind.Function,
insertText: key + '(' + this.removeParamFormat(value.Params.toString()) + ')',
documentation: value.Introduction,
};
completionList.push(item);
});
case 'primitive type':
case 'keyword':
return CompletionItemKind.Keyword;
case 'var':
case 'local var':
return CompletionItemKind.Variable;
case 'property':
case 'getter':
case 'setter':
return CompletionItemKind.Field;
case 'function':
case 'method':
case 'construct':
case 'call':
case 'index':
return CompletionItemKind.Function;
case 'enum':
return CompletionItemKind.Enum;
case 'module':
return CompletionItemKind.Module;
case 'class':
return CompletionItemKind.Class;
case 'interface':
return CompletionItemKind.Interface;
case 'warning':
return CompletionItemKind.File;
}
return CompletionItemKind.Property;
}
provider.collectAttributes(tag, (attribute, type, documentation) => {
if ((type === 'event' && filterPrefix !== '@') || (type !== 'event' && filterPrefix === '@')) {
return;
}
let codeSnippet = attribute;
if (type !== 'v' && value.length) {
codeSnippet = codeSnippet + value;
}
result.items.push({
label: attribute,
kind: type === 'event' ? CompletionItemKind.Function : CompletionItemKind.Value,
textEdit: TextEdit.replace(range, codeSnippet),
insertTextFormat: InsertTextFormat.Snippet,
sortText: priority + attribute,
documentation
});
});
});