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

To help you get started, we’ve selected a few vscode-languageserver 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 apazureck / openui5vscodeTypescriptTools / ui5xmlserver / src / providers / XmlCompletionProvider.ts View on Github external
// Get Type if type is given as attribute, which indicates it may be used by others.
			if (e.$ && e.$.type) {
				derivedelements = derivedelements.concat(this.getDerivedElements(e, element.schema));
				// Get Elements if type is a reference
			} else if (e.$ && e.$.ref) {
				e = this.getElementFromReference(e.$.ref, element.schema);
				if (e && e.$ && e.$.type)
					derivedelements = derivedelements.concat(this.getDerivedElements(e, element.schema));
			} else {
				ownelements.push(e);
			}

		// Append additional elements
		for (const ns in this.usedNamespaces) {
			if (this.usedNamespaces[ns] === element.schema.targetNamespace) {
				foundElements.push({ namespace: ns, elements: ownelements, ciKind: CompletionItemKind.Property });
				break;
			}
		}

		foundElements = foundElements.concat(derivedelements);
		let ret: CompletionItem[] = [];
		for (let item of foundElements) {
			for (const entry of item.elements)
				try {
					const citem = CompletionItem.create(entry.$.name);
					const nsprefix = item.namespace.length > 0 ? item.namespace + ":" : "";
					citem.insertText = "<" + nsprefix + entry.$.name + ">$0";
					citem.insertTextFormat = 2;
					citem.kind = item.ciKind || CompletionItemKind.Class;
					if (item.namespace.length > 0)
						citem.detail = "Namespace: " + item.namespace;
github aurelia / vscode-extension / src / server / Completions / BaseAttributeCompletionFactory.ts View on Github external
documentation: MarkedString.fromPlainText(value.documentation).toString(),
          detail: 'Bindable Attribute',
          insertText: value.customBindingSnippet === null ? `${key}.bind=${quote}$0${quote}`: value.customBindingSnippet.replace('"', quote),
          insertTextFormat: InsertTextFormat.Snippet,
          kind: CompletionItemKind.Value,
          label: value.customLabel === null ? (key + '.bind') : value.customLabel,
        });
      }

      if (value instanceof EmptyAttribute) {
        result.push({
          detail: 'Empty Custom Attribute',
          documentation: MarkedString.fromPlainText(value.documentation).toString(),
          insertText: `${key}`,
          insertTextFormat: InsertTextFormat.PlainText,
          kind: CompletionItemKind.Property,
          label: key,
        });        
      }

      if (value instanceof SimpleAttribute || value instanceof BindableAttribute) {
        result.push({
          documentation: MarkedString.fromPlainText(value.documentation).toString(),
          detail: 'Attribute',
          insertText: `${key}=${quote}$0${quote}`,
          insertTextFormat: InsertTextFormat.Snippet,
          kind: CompletionItemKind.Property,
          label: key,
        });        
      }
    }  
    return result;
github iamcco / vim-language-server / src / server / builtin.ts View on Github external
public getDocumentByCompletionItem(
    params: { label: string, kind: CompletionItemKind } | CompletionItem,
  ): CompletionItem | undefined {
    const { kind } = params;
    switch (kind) {
      case CompletionItemKind.Variable:
        if (!this.vimPredefinedVariableDocuments[params.label]) {
          return;
        }
        return {
          ...params,
          documentation: this.formatVimDocument(
            this.vimPredefinedVariableDocuments[params.label],
          ),
        };
      case CompletionItemKind.Property:
        if (!this.vimOptionDocuments[params.label]) {
          return;
        }
        return {
          ...params,
          documentation: this.formatVimDocument(
            this.vimOptionDocuments[params.label],
          ),
        };
      case CompletionItemKind.Function:
        if (!this.vimBuiltFunctionDocuments[params.label]) {
          return;
        }
        return {
          ...params,
          documentation: this.formatVimDocument(
github juanfranblanco / vscode-solidity / src / completionService.ts View on Github external
function getTxCompletionItems(): CompletionItem[] {
    return [
        {
            detail: '(uint): gas price of the transaction',
            kind: CompletionItemKind.Property,
            label: 'gas',
        },
        {
            detail: '(address): sender of the transaction (full call chain)',
            kind: CompletionItemKind.Property,
            label: 'origin',
        },
    ];
}
github sourcegraph / javascript-typescript-langserver / src / typescript-service.ts View on Github external
/**
 * Maps string-based CompletionEntry::kind to enum-based CompletionItemKind
 */
const completionKinds: { [name: string]: CompletionItemKind } = {
	class: CompletionItemKind.Class,
	constructor: CompletionItemKind.Constructor,
	enum: CompletionItemKind.Enum,
	field: CompletionItemKind.Field,
	file: CompletionItemKind.File,
	function: CompletionItemKind.Function,
	interface: CompletionItemKind.Interface,
	keyword: CompletionItemKind.Keyword,
	method: CompletionItemKind.Method,
	module: CompletionItemKind.Module,
	property: CompletionItemKind.Property,
	reference: CompletionItemKind.Reference,
	snippet: CompletionItemKind.Snippet,
	text: CompletionItemKind.Text,
	unit: CompletionItemKind.Unit,
	value: CompletionItemKind.Value,
	variable: CompletionItemKind.Variable
};
github apazureck / openui5vscodeTypescriptTools / ui5xmlserver / src / providers / XmlCompletionProvider.ts View on Github external
private getCompletionItemForSingleAttribute(attribute: Attribute, schema: StorageSchema): CompletionItem {
		const ce: CompletionItem = {
			label: attribute.$.name,
			kind: CompletionItemKind.Property,
			insertText: " " + attribute.$.name + "=\"$0\" ",
			insertTextFormat: 2
		}
		try {
			ce.detail = attribute.owner ? "from " + attribute.owner.$.name : undefined;
		} catch (error) {

		}
		try {
			ce.documentation = this.markdownText(attribute.annotation[0].documentation[0]);
		} catch (error) {

		}
		return ce;
	}
github marko-js / language-server / server / src / util-old / javascript.ts View on Github external
return CompletionItemKind.Enum;
    case "module":
      return CompletionItemKind.Module;
    case "class":
      return CompletionItemKind.Class;
    case "interface":
      return CompletionItemKind.Interface;
    case "warning":
      return CompletionItemKind.File;
    case "script":
      return CompletionItemKind.File;
    case "directory":
      return CompletionItemKind.Folder;
  }

  return CompletionItemKind.Property;
}
github joelday / papyrus-lang / packages / papyrus-lang-lsp-server / src / features / Completions.ts View on Github external
function getCompletionItemKind(symbol: Symbol) {
    switch (symbol.kind) {
        case PapyrusSymbolKind.Function:
            return CompletionItemKind.Method;
        case PapyrusSymbolKind.Property:
            return CompletionItemKind.Property;
        case PapyrusSymbolKind.Script:
            return CompletionItemKind.Class;
        case PapyrusSymbolKind.Struct:
            return CompletionItemKind.Struct;
        case PapyrusSymbolKind.Event:
            return CompletionItemKind.Event;
        case PapyrusSymbolKind.Variable:
            if (symbol.parent.kind === PapyrusSymbolKind.Script || symbol.parent.kind === PapyrusSymbolKind.Struct) {
                return CompletionItemKind.Field;
            }

            return CompletionItemKind.Variable;
        default:
            return null;
    }
}
github linkedin / css-blocks / packages / @css-blocks / language-server / src / server.ts View on Github external
.forEach(blockClass => {
                const classCompletion: CompletionItem = {
                  label: blockClass.name,
                  kind: CompletionItemKind.Property,
                };

                const classAttributeCompletions = blockClass
                  .getAttributes()
                  .map(
                    (attr): CompletionItem => ({
                      label: `${attr.namespace}:${attr.name}`,
                      kind: CompletionItemKind.Property,
                    }),
                  );

                completions = completions.concat(
                  classCompletion,
                  classAttributeCompletions,
                );
              });
github juanfranblanco / vscode-solidity / src / completionService.ts View on Github external
kind: CompletionItemKind.Property,
            label: 'gas',
        },
        {
            detail: '(address): sender of the message (current call)',
            kind: CompletionItemKind.Property,
            label: 'sender',
        },
        {
            detail: '(bytes4): first four bytes of the calldata (i.e. function identifier)',
            kind: CompletionItemKind.Property,
            label: 'sig',
        },
        {
            detail: '(uint): number of wei sent with the message',
            kind: CompletionItemKind.Property,
            label: 'value',
        },
    ];
}