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;
}
}
function _variableSymbol(node: StylusNode, text: string[], currentWord: string): CompletionItem {
const name = node.name;
const lineno = Number(node.val!.lineno!) - 1;
const completionItem = CompletionItem.create(name);
completionItem.detail = text[lineno].trim();
completionItem.kind = CompletionItemKind.Variable;
return completionItem;
}
function translateionCompletionItemKind(kind: CompletionItemKind): ts.ScriptElementKind {
switch (kind) {
case CompletionItemKind.Method:
return ts.ScriptElementKind.memberFunctionElement;
case CompletionItemKind.Function:
return ts.ScriptElementKind.functionElement;
case CompletionItemKind.Constructor:
return ts.ScriptElementKind.constructorImplementationElement;
case CompletionItemKind.Field:
case CompletionItemKind.Variable:
return ts.ScriptElementKind.variableElement;
case CompletionItemKind.Class:
return ts.ScriptElementKind.classElement;
case CompletionItemKind.Interface:
return ts.ScriptElementKind.interfaceElement;
case CompletionItemKind.Module:
return ts.ScriptElementKind.moduleElement;
case CompletionItemKind.Property:
return ts.ScriptElementKind.memberVariableElement;
case CompletionItemKind.Unit:
case CompletionItemKind.Value:
return ts.ScriptElementKind.constElement;
case CompletionItemKind.Enum:
return ts.ScriptElementKind.enumElement;
case CompletionItemKind.Keyword:
return ts.ScriptElementKind.keyword;
function convertKind(kind: string): CompletionItemKind {
switch (kind) {
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;
CSSCompletion.prototype.getVariableProposals = function (existingNode, result) {
var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, nodes.ReferenceType.Variable);
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var insertText = strings.startsWith(symbol.name, '--') ? "var(" + symbol.name + ")" : symbol.name;
var suggest = {
label: symbol.name,
documentation: symbol.value ? strings.getLimitedString(symbol.value) : symbol.value,
textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText),
kind: CompletionItemKind.Variable,
sortText: 'z'
};
if (symbol.node.type === nodes.NodeType.FunctionParameter) {
var mixinNode = (symbol.node.getParent());
if (mixinNode.type === nodes.NodeType.MixinDeclaration) {
suggest.detail = localize('completion.argument', 'argument from \'{0}\'', mixinNode.getName());
}
}
result.items.push(suggest);
}
return result;
};
CSSCompletion.prototype.getVariableProposalsForCSSVarFunction = 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;
}
}
function convertKind(kind: ts.ScriptElementKind): CompletionItemKind {
switch (kind) {
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;
function convertKind(kind: string): CompletionItemKind {
switch (kind) {
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;