How to use the vscode-languageserver.CompletionItemKind.Function 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 GameMakerDiscord / gml-tools-langserver / src / completion.ts View on Github external
kind: CompletionItemKind.Function,
                    textEdit: {
                        newText: thisItem.replace(thisWord, ''),
                        range: thisRange
                    }
                });
            }
        }

        // Extensions
        const extensionList = this.reference.extensionGetAllExtensionNames();
        for (const thisItem of extensionList) {
            if (thisItem && rx.test(thisItem) === true) {
                workingArray.push({
                    label: thisItem,
                    kind: CompletionItemKind.Function,
                    textEdit: {
                        newText: thisItem.replace(thisWord, ''),
                        range: thisRange
                    }
                });
            }
        }

        // Objects
        const objectList = this.reference.objectGetList();
        for (const thisItem of objectList) {
            if (rx.test(thisItem) === true) {
                workingArray.push({
                    label: thisItem,
                    kind: CompletionItemKind.Class,
                    textEdit: {
github tomi / vscode-rf-language-server / server / src / intellisense / completion-provider / completion-helper.ts View on Github external
if (textToSearch.includes(" ")) {
          // VSCode completion handles only complete words and not spaces,
          // so everything before the last space needs to be trimmed
          // from the insert text for it to work correctly
          const textBeforeLastSpace = textToSearch.substr(
            0,
            textToSearch.lastIndexOf(" ") + 1
          );

          insertText = _removeFromBeginning(insertText, textBeforeLastSpace);
        }

        return {
          label: shouldSuggestNamespace ? keyword.id.fullName : keyword.id.name,
          kind: CompletionItemKind.Function,
          insertText,
          insertTextFormat,
          detail,
          documentation,
        };
      });
    });
github iamcco / vim-language-server / src / server / buffer.ts View on Github external
if (idx === 0) {
            return `\${${idx + 1}:${value}}`;
          }
          return `${res}, \${${idx + 1}:${value}}`;
        }, "");
      }
      let label = name;
      if (/^/.test(name)) {
        label = name.replace(/^/, "s:");
      }
      return {
        label,
        detail: "any",
        sortText,
        documentation: "User defined function",
        kind: CompletionItemKind.Function,
        insertText: `${label}(${args})\${0}`,
        insertTextFormat: InsertTextFormat.Snippet,
      };
    });
  }
github fduman / vscode-nodemcu / server / src / completionItems / modules / tsl2561.ts View on Github external
{
		kind: CompletionItemKind.Function,
		label: 'getlux',
		data: 'tsl2561.getlux',
		detail: 'getlux()',
		documentation: `Reads sensor values from the device and returns calculated lux value.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'getrawchannels',
		data: 'tsl2561.getrawchannels',
		detail: 'getrawchannels()',
		documentation: `Reads the device's 2 sensors and returns their values.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'init',
		data: 'tsl2561.init',
		detail: 'init(sdapin, sclpin[, address[, package]])',
		documentation: `Initializes the device on pins sdapin & sclpin. Optionally also configures the devices address and package. Default: address pin floating (0x39) and FN package.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'settiming',
		data: 'tsl2561.settiming',
		detail: 'settiming(integration, gain)',
		documentation: `Sets the integration time and gain settings of the device. When 'tls2561.init()' is called, these values default to 402 ms and no gain.`
	},
];
github iamcco / vim-language-server / src / script / build-docs.ts View on Github external
idx++;
        }
      }
      if (m) {
        if (completionItem) {
          this.vimBuiltinFunctionItems.push(
            completionItem,
          );
          if (this.vimBuiltFunctionDocuments[completionItem.label]) {
            this.vimBuiltFunctionDocuments[completionItem.label].pop();
          }
        }
        const label = m[2];
        completionItem = {
          label,
          kind: CompletionItemKind.Function,
          detail: "",
          documentation: "",
          sortText: "00004",
          insertText: this.formatFunctionSnippets(m[2], m[3]),
          insertTextFormat: InsertTextFormat.Snippet,
        };
        if (!this.vimBuiltFunctionDocuments[label]) {
          this.vimBuiltFunctionDocuments[label] = [];
        }
        this.vimBuiltFunctionSignatureHelp[label] = [
          m[3],
          "",
        ];
      } else if (/^(================|[ \t]*vim:tw=78:ts=8:ft=help:norl:)/.test(line)) {
        if (completionItem) {
          this.vimBuiltinFunctionItems.push(
github fduman / vscode-nodemcu / server / src / completionItems / modules / node.ts View on Github external
{
		kind: CompletionItemKind.Enum,
		label: 'CPU80MHZ',
		data: 'node.CPU80MHZ',
		detail: 'CPU80MHZ',
		documentation: `CPU 80MHZ`
	},
	{
		kind: CompletionItemKind.Enum,
		label: 'CPU160MHZ',
		data: 'node.CPU160MHZ',
		detail: 'CPU160MHZ',
		documentation: `CPU 160MHZ`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'bootreason',
		data: 'node.bootreason',
		detail: 'bootreason()',
		documentation: `Returns the boot reason and extended reset info.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'chipid',
		data: 'node.chipid',
		detail: 'chipid()',
		documentation: `Returns the ESP chip ID.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'compile',
		data: 'node.compile',
github fduman / vscode-nodemcu / server / src / completionItems / modules / spi.ts View on Github external
{
		kind: CompletionItemKind.Enum,
		label: 'FULLDUPLEX',
		data: 'spi.FULLDUPLEX',
		detail: 'FULLDUPLEX',
		documentation: `Full duplex`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'recv',
		data: 'spi.recv',
		detail: 'recv(id, size[, default_data])',
		documentation: `Receive data from SPI.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'send',
		data: 'spi.send',
		detail: 'send(id, data1[, data2[, ..., datan]])',
		documentation: `Send data via SPI in half-duplex mode. Send & receive data in full-duplex mode.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'setup',
		data: 'spi.setup',
		detail: 'setup(id, mode, cpol, cpha, databits, clock_div[, duplex_mode])',
		documentation: `Set up the SPI configuration. Refer to [Serial Peripheral Interface Bus](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Clock_polarity_and_phase) for details regarding the clock polarity and phase definition.`
	},
	{
		kind: CompletionItemKind.Function,
		label: 'get_miso',
		data: 'spi.get_miso',
github elm-tooling / elm-language-server / src / providers / completionProvider.ts View on Github external
private createFunctionCompletion(
    markdownDocumentation: string | undefined,
    label: string,
    range: Range,
  ): CompletionItem {
    return this.createCompletion(
      markdownDocumentation,
      CompletionItemKind.Function,
      label,
      range,
    );
  }
github mikrovvelle / mlxprs / server / serverTools.ts View on Github external
function mlFnDoc2CompletionItem(docObject: MarkLogicFnDocsObject): CompletionItem {
    let completionItem: CompletionItem = {
        label: `${docObject.prefix}:${docObject.name}()`,
        kind: CompletionItemKind.Function,
        documentation: docObject.summary,
        detail: buildFullFunctionSignature(docObject),
        insertText: buildFunctionCompletion(docObject),
        data: docObject
    }
    return completionItem
}
github prabirshrestha / typescript-language-server / src / utils.ts View on Github external
export function uriToPath(uri: string): string {
	const p = path.resolve(uri.replace(/file:\/\/\//, ''));
	return isWindows() ? p.replace(/\//g, '\\') : p;
}

export function pathToUri(p: string): string {
	return 'file://' + (isWindows() ? '/' + p.replace(/\//g, '/') : p);
}

export const completionKindsMapping: { [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
};

export class Deferred {
    resolve: (value?: T) => void;
    reject: (err?: any) => void;