How to use the vscode-languageserver-types.CompletionItemKind.Property function in vscode-languageserver-types

To help you get started, we’ve selected a few vscode-languageserver-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github linkedin / css-blocks / packages / @css-blocks / language-server / src / util / hbsCompletionProvider.ts View on Github external
}

    let attributeAtCursor = itemAtCursor.attribute;
    if (attributeAtCursor.referencedBlock) {
      block = block.getExportedBlock(attributeAtCursor.referencedBlock);
    }

    if (!block) {
      return [];
    }

    if (attributeAtCursor.attributeType === AttributeType.ambiguous) {
      let completions: CompletionItem[] = [
        {
          label: "block:",
          kind: CompletionItemKind.Property,
        },
      ];
      block.eachBlockExport((name) => {
        completions.push({
          label: `${name}:`,
          kind: CompletionItemKind.Property,
        });
      });
      return completions;
    }

    if (attributeAtCursor.attributeType === AttributeType.class) {
      return block.classes
        // TODO: we should look at scope attributes if the user is on the
        // root element.
        .filter(blockClass => !blockClass.isRoot)
github threadheap / serverless-ide-vscode / packages / language-server / src / language-service / services / completion / custom-tags.ts View on Github external
case ReferenceType.DEPENDS_ON: {
				const options = addReferenceablesOptions(
					customTag,
					referenceables
				)
				const value = `\${1${options}\}`

				collector.add({
					kind: CompletionItemKind.Value,
					label: customTag.tag,
					insertText: `${customTag.tag} ${value}`,
					insertTextFormat: InsertTextFormat.Snippet
				})

				collector.add({
					kind: CompletionItemKind.Property,
					label: customTag.propertyName,
					insertText: `${customTag.propertyName}: ${value}`,
					insertTextFormat: InsertTextFormat.Snippet
				})
			}
		}
	} else {
		collector.add({
			kind: CompletionItemKind.Value,
			label: customTag.tag,
			insertText: customTag.tag + " ",
			insertTextFormat: InsertTextFormat.Snippet,
			documentation: customTag.description
		})

		collector.add({
github microsoft / vscode / extensions / html / server / src / service / services / htmlCompletion.ts View on Github external
function collectCloseTagSuggestions(afterOpenBracket: number, matchingOnly: boolean): CompletionList {
		let range = getReplaceRange(afterOpenBracket);
		let contentAfter = document.getText().substr(offset);
		let closeTag = contentAfter.match(/^\s*>/) ? '' : '>';
		let curr = node;
		while (curr) {
			let tag = curr.tag;
			if (tag && !curr.closed) {
				result.items.push({
					label: '/' + tag,
					kind: CompletionItemKind.Property,
					filterText: '/' + tag + closeTag,
					textEdit: { newText: '/' + tag + closeTag, range: range }
				});
				return result;
			}
			curr = curr.parent;
		}
		if (matchingOnly) {
			return result;
		}

		tagProviders.forEach((provider) => {
			provider.collectTags((tag, label) => {
				result.items.push({
					label: '/' + tag,
					kind: CompletionItemKind.Property,
github threadheap / serverless-ide-vscode / packages / language-server / src / language-service / services / completion / helpers.ts View on Github external
export const getSuggestionKind = (type: any): CompletionItemKind => {
	if (Array.isArray(type)) {
		const array = type as any[]
		type = array.length > 0 ? array[0] : null
	}
	if (!type) {
		return CompletionItemKind.Value
	}
	switch (type) {
		case "string":
			return CompletionItemKind.Value
		case "object":
			return CompletionItemKind.Module
		case "property":
			return CompletionItemKind.Property
		default:
			return CompletionItemKind.Value
	}
}
github neoclide / coc-html / server / modes / javascriptMode.ts View on Github external
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;
}
github microsoft / typescript-styled-plugin / src / vscode-language-service-adapter.ts View on Github external
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;
        case CompletionItemKind.Color:
            return ts.ScriptElementKind.constElement;
        case CompletionItemKind.Reference:
            return ts.ScriptElementKind.alias;
        case CompletionItemKind.File:
            return ts.ScriptElementKind.moduleElement;
        case CompletionItemKind.Snippet:
        case CompletionItemKind.Text:
github codesandbox / codesandbox-client / standalone-packages / vscode-extensions / out / extensions / jpoissonnier.vscode-styled-components-0.0.26 / node_modules / vscode-css-languageservice / lib / esm / services / cssCompletion.js View on Github external
insertText = entry.name;
                if (!isDefined(declaration.colonPosition)) {
                    insertText += ': ';
                    retrigger = true;
                }
            }
            else {
                range = _this.getCompletionRange(null);
                insertText = entry.name + ': ';
                retrigger = true;
            }
            var item = {
                label: entry.name,
                documentation: languageFacts.getEntryDescription(entry),
                textEdit: TextEdit.replace(range, insertText),
                kind: CompletionItemKind.Property
            };
            if (!entry.restrictions) {
                retrigger = false;
            }
            if (retrigger) {
                item.command = {
                    title: 'Suggest',
                    command: 'editor.action.triggerSuggest'
                };
            }
            if (strings.startsWith(entry.name, '-')) {
                item.sortText = 'x';
            }
            result.items.push(item);
        });
        this.completionParticipants.forEach(function (participant) {
github aurelia / vscode-extension / src / server / aurelia-languageservice / services / htmlCompletion.ts View on Github external
tagProvider.collectTags((tag, label) => {
      result.items.push({
        documentation: label,
        kind: CompletionItemKind.Property,
        label: tag,
      });
    });
    return result;
github chemzqm / wxml-languageserver / src / services / wxmlComplete.ts View on Github external
function collectAutoCloseTagSuggestion(
    tagCloseEnd: number,
    tag: string,
  ): CompletionList {
    if (!isEmptyElement(tag)) {
      let pos = document.positionAt(tagCloseEnd)
      result.items.push({
        label: '',
        kind: CompletionItemKind.Property,
        filterText: '',
        textEdit: TextEdit.insert(pos, '$0'),
        insertTextFormat: InsertTextFormat.Snippet,
      })
    }
    return result
  }
github vuejs / vetur / server / src / modes / template / services / htmlCompletion.ts View on Github external
provider.collectTags((tag, label) => {
        result.items.push({
          label: tag,
          kind: CompletionItemKind.Property,
          documentation: label,
          textEdit: TextEdit.replace(range, tag),
          sortText: priority + tag,
          insertTextFormat: InsertTextFormat.PlainText
        });
      });
    });