javascript-typescript-langserver
Version:
Implementation of the Language Server Protocol for JavaScript and TypeScript
59 lines (58 loc) • 2.56 kB
TypeScript
import { Observable } from 'rxjs';
import * as ts from 'typescript';
import { SymbolDescriptor } from './request-type';
/**
* Converts an Iterable to an Observable.
* Workaround for https://github.com/ReactiveX/rxjs/issues/2306
*/
export declare function observableFromIterable<T>(iterable: Iterable<T>): Observable<T>;
/**
* Template string tag to escape JSON Pointer components as per https://tools.ietf.org/html/rfc6901#section-3
*/
export declare function JSONPTR(strings: TemplateStringsArray, ...toEscape: string[]): string;
/**
* Makes documentation string from symbol display part array returned by TS
*/
export declare function docstring(parts: ts.SymbolDisplayPart[]): string;
/**
* Normalizes path to match POSIX standard (slashes)
* This conversion should only be necessary to convert windows paths when calling TS APIs.
*/
export declare function toUnixPath(filePath: string): string;
/**
* Normalizes URI encoding by encoding _all_ special characters in the pathname
*/
export declare function normalizeUri(uri: string): string;
/**
* Converts an abolute path to a file:// uri
*
* @param path an absolute path
*/
export declare function path2uri(path: string): string;
/**
* Converts a uri to an absolute path.
* The OS style is determined by the URI. E.g. `file:///c:/foo` always results in `c:\foo`
*
* @param uri a file:// uri
*/
export declare function uri2path(uri: string): string;
export declare function isJSTSFile(filename: string): boolean;
export declare function isConfigFile(filename: string): boolean;
export declare function isPackageJsonFile(filename: string): boolean;
export declare function isGlobalTSFile(filename: string): boolean;
export declare function isDependencyFile(filename: string): boolean;
export declare function isDeclarationFile(filename: string): boolean;
/**
* Compares two values and returns a numeric score between 0 and 1 defining of how well they match.
* E.g. if 2 of 4 properties in the query match, will return 2
*/
export declare function getMatchingPropertyCount(query: any, value: any): number;
/**
* Returns the maximum score that could be achieved with the given query (the amount of "leaf" properties)
* E.g. for `{ name, kind, package: { name }}` will return 3
*/
export declare function getPropertyCount(query: any): number;
/**
* Returns true if the passed SymbolDescriptor has at least the same properties as the passed partial SymbolDescriptor
*/
export declare function isSymbolDescriptorMatch(query: Partial<SymbolDescriptor>, symbol: SymbolDescriptor): boolean;