How to use the vscode-languageserver.CompletionItemKind.Enum 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 kube / vscode-clang-complete / src / server / completion.ts View on Github external
export const itemKind = (detail: string) =>
  when(detail)
    // is a Macro Function
    .match(/^[^a-z ]+\(.*\)/, CompletionItemKind.Function)
    // is a Function
    .match(/.*\(.*\)/, CompletionItemKind.Function)
    // is an Enum
    .match(/^enum /, CompletionItemKind.Enum)
    // is a Pointer or a Reference
    .match(/.*[*&]+/, CompletionItemKind.Reference)
    // is an Object Macro
    .match(/^[^a-z]+$/, CompletionItemKind.Snippet)
    // is a Type
    .match(/^[^ ()*]+$/, CompletionItemKind.Keyword)
    // is a Variable
    .else(CompletionItemKind.Variable)
github RLovelett / vscode-swift / vscode-swift-language-server / src / server.ts View on Github external
case "source.lang.swift.decl.protocol":
							item.kind = CompletionItemKind.Interface;
							break;
						case "source.lang.swift.decl.class":
							item.kind = CompletionItemKind.Class;
							break;
						case "source.lang.swift.decl.struct":
							item.kind = CompletionItemKind.Value;
							break;
						case "source.lang.swift.decl.function.constructor":
							item.kind = CompletionItemKind.Constructor;
							item.insertText = value.sourcetext;
							item.documentation = value.descriptionKey;
							break;
						case "source.lang.swift.decl.enum":
							item.kind = CompletionItemKind.Enum;
							break;
						case "source.lang.swift.decl.typealias":
							item.kind = CompletionItemKind.Reference;
							break;
						default:
							connection.console.log(`Unmatched: ${value.kind}`);
							break;
					}
					return item;
				});
				resolve(items);
github juanfranblanco / vscode-solidity / src / completionService.ts View on Github external
keywords.forEach(unit => {
        const completionItem =  CompletionItem.create(unit);
        completionItem.kind = CompletionItemKind.Keyword;
        completionItems.push(completionItem);
    });

    completionItems.push(CreateCompletionItem('contract', CompletionItemKind.Class, null));
    completionItems.push(CreateCompletionItem('library', CompletionItemKind.Class, null));
    completionItems.push(CreateCompletionItem('storage', CompletionItemKind.Field, null));
    completionItems.push(CreateCompletionItem('memory', CompletionItemKind.Field, null));
    completionItems.push(CreateCompletionItem('var', CompletionItemKind.Field, null));
    completionItems.push(CreateCompletionItem('constant', CompletionItemKind.Constant, null));
    completionItems.push(CreateCompletionItem('constructor', CompletionItemKind.Constructor, null));
    completionItems.push(CreateCompletionItem('event', CompletionItemKind.Event, null));
    completionItems.push(CreateCompletionItem('import', CompletionItemKind.Module, null));
    completionItems.push(CreateCompletionItem('enum', CompletionItemKind.Enum, null));
    completionItems.push(CreateCompletionItem('struct', CompletionItemKind.Struct, null));
    completionItems.push(CreateCompletionItem('function', CompletionItemKind.Function, null));

    return completionItems;
}
github sourcegraph / javascript-typescript-langserver / src / typescript-service.ts View on Github external
export type TypeScriptServiceFactory = (client: LanguageClient, options?: TypeScriptServiceOptions) => TypeScriptService

/**
 * Settings synced through `didChangeConfiguration`
 */
export interface Settings extends PluginSettings {
    format: ts.FormatCodeSettings
}

/**
 * Maps string-based CompletionEntry::kind to enum-based CompletionItemKind
 */
const completionKinds = new Map([
    [`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 SkaceKamen / vscode-sqflint / server / src / modules / mission.ts View on Github external
this.findMarkers(name).map(name => {
				return {
					label: name,
					data: name,
					filterText: name,
					insertText: '"' + name + '"',
					kind: CompletionItemKind.Enum as any
				}
			})
		)
github fduman / vscode-nodemcu / server / src / completionItems / modules / spi.ts View on Github external
{
		kind: CompletionItemKind.Enum,
		label: 'CPOL_LOW',
		data: 'spi.CPOL_LOW',
		detail: 'CPOL_LOW',
		documentation: `Low clock polarity`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'CPOL_HIGH',
		data: 'spi.CPOL_HIGH',
		detail: 'CPOL_HIGH',
		documentation: `High clock polarity`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'CPHA_LOW',
		data: 'spi.CPHA_LOW',
		detail: 'CPHA_LOW',
		documentation: `Low clock phase`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'CPHA_HIGH',
		data: 'spi.CPHA_HIGH',
		detail: 'CPHA_HIGH',
		documentation: `High clock phase`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'HALFDUPLEX',
		data: 'spi.HALFDUPLEX',
github fduman / vscode-nodemcu / server / src / completionItems / modules / tmr.ts View on Github external
{
		kind: CompletionItemKind.Enum,
		label: 'ALARM_SINGLE',
		data: 'tmr.ALARM_SINGLE',
		detail: 'ALARM_SINGLE',
		documentation: `A one-shot alarm (and no need to call tmr.unregister())`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'ALARM_SEMI',
		data: 'tmr.ALARM_SEMI',
		detail: 'ALARM_SEMI',
		documentation: `Manually repeating alarm (call tmr.start() to restart)`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'ALARM_AUTO',
		data: 'tmr.ALARM_AUTO',
		detail: 'ALARM_AUTO',
		documentation: `Automatically repeating alarm`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'alarm',
		data: 'tmr.alarm',
		detail: 'alarm(id, interval_ms, mode)',
		documentation: `This is a convenience function combining ['tmr.register()'](#tmrregister) and ['tmr.start()'](#tmrstart) into a single call.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'delay',
		data: 'tmr.delay',
github elm-tooling / elm-language-server / src / providers / completionProvider.ts View on Github external
private createTypeCompletion(
    markdownDocumentation: string | undefined,
    label: string,
    range: Range,
  ): CompletionItem {
    return this.createCompletion(
      markdownDocumentation,
      CompletionItemKind.Enum,
      label,
      range,
    );
  }
github fduman / vscode-nodemcu / server / src / completionItems / modules / gpio.ts View on Github external
import { CompletionItem, CompletionItemKind } from 'vscode-languageserver';

export const gpio: CompletionItem[] = [
	{
		kind: CompletionItemKind.Enum,
		label: 'OUTPUT',
		data: 'gpio.OUTPUT',
		detail: 'OUTPUT',
		documentation: `Output mode`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'OPENDRAIN',
		data: 'gpio.OPENDRAIN',
		detail: 'OPENDRAIN',
		documentation: `Opendrain mode`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'INPUT',
		data: 'gpio.INPUT',
github vmware / vrealize-developer-tools / language-server / src / server / feature / CompletionProvider.ts View on Github external
.forEach(prop => {
                    const name = prop.name || ""
                    const completionItem = CompletionItem.create(name)
                    completionItem.kind = CompletionItemKind.Variable

                    if (prop.readOnly) {
                        completionItem.kind =
                            name.toUpperCase() === name ? CompletionItemKind.Enum : CompletionItemKind.Value
                    }

                    completionItem.documentation = prop.description ? prop.description.trim() : undefined
                    completionItem.detail = Previewer.computeDetailsForProperty(prop)
                    completionItem.sortText = `000${name}`
                    suggestions.push(completionItem)
                })
        }