Initial
This commit is contained in:
399
Client/node_modules/vscode-languageclient/lib/client.d.ts
generated
vendored
Executable file
399
Client/node_modules/vscode-languageclient/lib/client.d.ts
generated
vendored
Executable file
@@ -0,0 +1,399 @@
|
||||
import { TextDocumentChangeEvent, TextDocument, Disposable, OutputChannel, FileSystemWatcher as VFileSystemWatcher, DiagnosticCollection, Diagnostic as VDiagnostic, Uri, ProviderResult, CancellationToken, Position as VPosition, Location as VLocation, Range as VRange, CompletionItem as VCompletionItem, CompletionList as VCompletionList, SignatureHelp as VSignatureHelp, Definition as VDefinition, DocumentHighlight as VDocumentHighlight, SymbolInformation as VSymbolInformation, CodeActionContext as VCodeActionContext, Command as VCommand, CodeLens as VCodeLens, FormattingOptions as VFormattingOptions, TextEdit as VTextEdit, WorkspaceEdit as VWorkspaceEdit, Hover as VHover, CodeAction as VCodeAction, DocumentSymbol as VDocumentSymbol, DocumentLink as VDocumentLink, TextDocumentWillSaveEvent, WorkspaceFolder as VWorkspaceFolder, CompletionContext as VCompletionContext } from 'vscode';
|
||||
import { Message, RPCMessageType, ResponseError, RequestType, RequestType0, RequestHandler, RequestHandler0, GenericRequestHandler, NotificationType, NotificationType0, NotificationHandler, NotificationHandler0, GenericNotificationHandler, MessageReader, MessageWriter, Trace, Event, ClientCapabilities, TextDocumentRegistrationOptions, InitializeParams, InitializeResult, InitializeError, ServerCapabilities, DocumentSelector } from 'vscode-languageserver-protocol';
|
||||
import { ColorProviderMiddleware } from './colorProvider';
|
||||
import { ImplementationMiddleware } from './implementation';
|
||||
import { TypeDefinitionMiddleware } from './typeDefinition';
|
||||
import { ConfigurationWorkspaceMiddleware } from './configuration';
|
||||
import { WorkspaceFolderWorkspaceMiddleware } from './workspaceFolders';
|
||||
import { FoldingRangeProviderMiddleware } from './foldingRange';
|
||||
import * as c2p from './codeConverter';
|
||||
import * as p2c from './protocolConverter';
|
||||
export { Converter as Code2ProtocolConverter } from './codeConverter';
|
||||
export { Converter as Protocol2CodeConverter } from './protocolConverter';
|
||||
export * from 'vscode-languageserver-protocol';
|
||||
/**
|
||||
* An action to be performed when the connection is producing errors.
|
||||
*/
|
||||
export declare enum ErrorAction {
|
||||
/**
|
||||
* Continue running the server.
|
||||
*/
|
||||
Continue = 1,
|
||||
/**
|
||||
* Shutdown the server.
|
||||
*/
|
||||
Shutdown = 2
|
||||
}
|
||||
/**
|
||||
* An action to be performed when the connection to a server got closed.
|
||||
*/
|
||||
export declare enum CloseAction {
|
||||
/**
|
||||
* Don't restart the server. The connection stays closed.
|
||||
*/
|
||||
DoNotRestart = 1,
|
||||
/**
|
||||
* Restart the server.
|
||||
*/
|
||||
Restart = 2
|
||||
}
|
||||
/**
|
||||
* A pluggable error handler that is invoked when the connection is either
|
||||
* producing errors or got closed.
|
||||
*/
|
||||
export interface ErrorHandler {
|
||||
/**
|
||||
* An error has occurred while writing or reading from the connection.
|
||||
*
|
||||
* @param error - the error received
|
||||
* @param message - the message to be delivered to the server if know.
|
||||
* @param count - a count indicating how often an error is received. Will
|
||||
* be reset if a message got successfully send or received.
|
||||
*/
|
||||
error(error: Error, message: Message, count: number): ErrorAction;
|
||||
/**
|
||||
* The connection to the server got closed.
|
||||
*/
|
||||
closed(): CloseAction;
|
||||
}
|
||||
export interface InitializationFailedHandler {
|
||||
(error: ResponseError<InitializeError> | Error | any): boolean;
|
||||
}
|
||||
export interface SynchronizeOptions {
|
||||
configurationSection?: string | string[];
|
||||
fileEvents?: VFileSystemWatcher | VFileSystemWatcher[];
|
||||
}
|
||||
export declare enum RevealOutputChannelOn {
|
||||
Info = 1,
|
||||
Warn = 2,
|
||||
Error = 3,
|
||||
Never = 4
|
||||
}
|
||||
export interface HandleDiagnosticsSignature {
|
||||
(uri: Uri, diagnostics: VDiagnostic[]): void;
|
||||
}
|
||||
export interface ProvideCompletionItemsSignature {
|
||||
(document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken): ProviderResult<VCompletionItem[] | VCompletionList>;
|
||||
}
|
||||
export interface ResolveCompletionItemSignature {
|
||||
(item: VCompletionItem, token: CancellationToken): ProviderResult<VCompletionItem>;
|
||||
}
|
||||
export interface ProvideHoverSignature {
|
||||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VHover>;
|
||||
}
|
||||
export interface ProvideSignatureHelpSignature {
|
||||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VSignatureHelp>;
|
||||
}
|
||||
export interface ProvideDefinitionSignature {
|
||||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition>;
|
||||
}
|
||||
export interface ProvideReferencesSignature {
|
||||
(document: TextDocument, position: VPosition, options: {
|
||||
includeDeclaration: boolean;
|
||||
}, token: CancellationToken): ProviderResult<VLocation[]>;
|
||||
}
|
||||
export interface ProvideDocumentHighlightsSignature {
|
||||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDocumentHighlight[]>;
|
||||
}
|
||||
export interface ProvideDocumentSymbolsSignature {
|
||||
(document: TextDocument, token: CancellationToken): ProviderResult<VSymbolInformation[] | VDocumentSymbol[]>;
|
||||
}
|
||||
export interface ProvideWorkspaceSymbolsSignature {
|
||||
(query: string, token: CancellationToken): ProviderResult<VSymbolInformation[]>;
|
||||
}
|
||||
export interface ProvideCodeActionsSignature {
|
||||
(document: TextDocument, range: VRange, context: VCodeActionContext, token: CancellationToken): ProviderResult<(VCommand | VCodeAction)[]>;
|
||||
}
|
||||
export interface ProvideCodeLensesSignature {
|
||||
(document: TextDocument, token: CancellationToken): ProviderResult<VCodeLens[]>;
|
||||
}
|
||||
export interface ResolveCodeLensSignature {
|
||||
(codeLens: VCodeLens, token: CancellationToken): ProviderResult<VCodeLens>;
|
||||
}
|
||||
export interface ProvideDocumentFormattingEditsSignature {
|
||||
(document: TextDocument, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>;
|
||||
}
|
||||
export interface ProvideDocumentRangeFormattingEditsSignature {
|
||||
(document: TextDocument, range: VRange, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>;
|
||||
}
|
||||
export interface ProvideOnTypeFormattingEditsSignature {
|
||||
(document: TextDocument, position: VPosition, ch: string, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>;
|
||||
}
|
||||
export interface ProvideRenameEditsSignature {
|
||||
(document: TextDocument, position: VPosition, newName: string, token: CancellationToken): ProviderResult<VWorkspaceEdit>;
|
||||
}
|
||||
export interface ProvideDocumentLinksSignature {
|
||||
(document: TextDocument, token: CancellationToken): ProviderResult<VDocumentLink[]>;
|
||||
}
|
||||
export interface ResolveDocumentLinkSignature {
|
||||
(link: VDocumentLink, token: CancellationToken): ProviderResult<VDocumentLink>;
|
||||
}
|
||||
export interface NextSignature<P, R> {
|
||||
(this: void, data: P, next: (data: P) => R): R;
|
||||
}
|
||||
export interface DidChangeConfigurationSignature {
|
||||
(sections: string[] | undefined): void;
|
||||
}
|
||||
export interface _WorkspaceMiddleware {
|
||||
didChangeConfiguration?: (this: void, sections: string[] | undefined, next: DidChangeConfigurationSignature) => void;
|
||||
}
|
||||
export declare type WorkspaceMiddleware = _WorkspaceMiddleware & ConfigurationWorkspaceMiddleware & WorkspaceFolderWorkspaceMiddleware;
|
||||
/**
|
||||
* The Middleware lets extensions intercept the request and notications send and received
|
||||
* from the server
|
||||
*/
|
||||
export interface _Middleware {
|
||||
didOpen?: NextSignature<TextDocument, void>;
|
||||
didChange?: NextSignature<TextDocumentChangeEvent, void>;
|
||||
willSave?: NextSignature<TextDocumentWillSaveEvent, void>;
|
||||
willSaveWaitUntil?: NextSignature<TextDocumentWillSaveEvent, Thenable<VTextEdit[]>>;
|
||||
didSave?: NextSignature<TextDocument, void>;
|
||||
didClose?: NextSignature<TextDocument, void>;
|
||||
handleDiagnostics?: (this: void, uri: Uri, diagnostics: VDiagnostic[], next: HandleDiagnosticsSignature) => void;
|
||||
provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
|
||||
resolveCompletionItem?: (this: void, item: VCompletionItem, token: CancellationToken, next: ResolveCompletionItemSignature) => ProviderResult<VCompletionItem>;
|
||||
provideHover?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideHoverSignature) => ProviderResult<VHover>;
|
||||
provideSignatureHelp?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideSignatureHelpSignature) => ProviderResult<VSignatureHelp>;
|
||||
provideDefinition?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideDefinitionSignature) => ProviderResult<VDefinition>;
|
||||
provideReferences?: (this: void, document: TextDocument, position: VPosition, options: {
|
||||
includeDeclaration: boolean;
|
||||
}, token: CancellationToken, next: ProvideReferencesSignature) => ProviderResult<VLocation[]>;
|
||||
provideDocumentHighlights?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideDocumentHighlightsSignature) => ProviderResult<VDocumentHighlight[]>;
|
||||
provideDocumentSymbols?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideDocumentSymbolsSignature) => ProviderResult<VSymbolInformation[] | VDocumentSymbol[]>;
|
||||
provideWorkspaceSymbols?: (this: void, query: string, token: CancellationToken, next: ProvideWorkspaceSymbolsSignature) => ProviderResult<VSymbolInformation[]>;
|
||||
provideCodeActions?: (this: void, document: TextDocument, range: VRange, context: VCodeActionContext, token: CancellationToken, next: ProvideCodeActionsSignature) => ProviderResult<(VCommand | VCodeAction)[]>;
|
||||
provideCodeLenses?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideCodeLensesSignature) => ProviderResult<VCodeLens[]>;
|
||||
resolveCodeLens?: (this: void, codeLens: VCodeLens, token: CancellationToken, next: ResolveCodeLensSignature) => ProviderResult<VCodeLens>;
|
||||
provideDocumentFormattingEdits?: (this: void, document: TextDocument, options: VFormattingOptions, token: CancellationToken, next: ProvideDocumentFormattingEditsSignature) => ProviderResult<VTextEdit[]>;
|
||||
provideDocumentRangeFormattingEdits?: (this: void, document: TextDocument, range: VRange, options: VFormattingOptions, token: CancellationToken, next: ProvideDocumentRangeFormattingEditsSignature) => ProviderResult<VTextEdit[]>;
|
||||
provideOnTypeFormattingEdits?: (this: void, document: TextDocument, position: VPosition, ch: string, options: VFormattingOptions, token: CancellationToken, next: ProvideOnTypeFormattingEditsSignature) => ProviderResult<VTextEdit[]>;
|
||||
provideRenameEdits?: (this: void, document: TextDocument, position: VPosition, newName: string, token: CancellationToken, next: ProvideRenameEditsSignature) => ProviderResult<VWorkspaceEdit>;
|
||||
provideDocumentLinks?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideDocumentLinksSignature) => ProviderResult<VDocumentLink[]>;
|
||||
resolveDocumentLink?: (this: void, link: VDocumentLink, token: CancellationToken, next: ResolveDocumentLinkSignature) => ProviderResult<VDocumentLink>;
|
||||
workspace?: WorkspaceMiddleware;
|
||||
}
|
||||
export declare type Middleware = _Middleware & TypeDefinitionMiddleware & ImplementationMiddleware & ColorProviderMiddleware & FoldingRangeProviderMiddleware;
|
||||
export interface LanguageClientOptions {
|
||||
documentSelector?: DocumentSelector | string[];
|
||||
synchronize?: SynchronizeOptions;
|
||||
diagnosticCollectionName?: string;
|
||||
outputChannel?: OutputChannel;
|
||||
outputChannelName?: string;
|
||||
revealOutputChannelOn?: RevealOutputChannelOn;
|
||||
/**
|
||||
* The encoding use to read stdout and stderr. Defaults
|
||||
* to 'utf8' if ommitted.
|
||||
*/
|
||||
stdioEncoding?: string;
|
||||
initializationOptions?: any | (() => any);
|
||||
initializationFailedHandler?: InitializationFailedHandler;
|
||||
errorHandler?: ErrorHandler;
|
||||
middleware?: Middleware;
|
||||
uriConverters?: {
|
||||
code2Protocol: c2p.URIConverter;
|
||||
protocol2Code: p2c.URIConverter;
|
||||
};
|
||||
workspaceFolder?: VWorkspaceFolder;
|
||||
}
|
||||
export declare enum State {
|
||||
Stopped = 1,
|
||||
Running = 2
|
||||
}
|
||||
export interface StateChangeEvent {
|
||||
oldState: State;
|
||||
newState: State;
|
||||
}
|
||||
export interface RegistrationData<T> {
|
||||
id: string;
|
||||
registerOptions: T;
|
||||
}
|
||||
/**
|
||||
* A static feature. A static feature can't be dynamically activate via the
|
||||
* server. It is wired during the initialize sequence.
|
||||
*/
|
||||
export interface StaticFeature {
|
||||
/**
|
||||
* Called to fill the initialize params.
|
||||
*
|
||||
* @params the initialize params.
|
||||
*/
|
||||
fillInitializeParams?: (params: InitializeParams) => void;
|
||||
/**
|
||||
* Called to fill in the client capabilities this feature implements.
|
||||
*
|
||||
* @param capabilities The client capabilities to fill.
|
||||
*/
|
||||
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
||||
/**
|
||||
* Initialize the feature. This method is called on a feature instance
|
||||
* when the client has successfully received the initalize request from
|
||||
* the server and before the client sends the initialized notification
|
||||
* to the server.
|
||||
*
|
||||
* @param capabilities the server capabilities
|
||||
* @param documentSelector the document selector pass to the client's constuctor.
|
||||
* May be `undefined` if the client was created without a selector.
|
||||
*/
|
||||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined): void;
|
||||
}
|
||||
export interface DynamicFeature<T> {
|
||||
/**
|
||||
* The message for which this features support dynamic activation / registration.
|
||||
*/
|
||||
messages: RPCMessageType | RPCMessageType[];
|
||||
/**
|
||||
* Called to fill the initialize params.
|
||||
*
|
||||
* @params the initialize params.
|
||||
*/
|
||||
fillInitializeParams?: (params: InitializeParams) => void;
|
||||
/**
|
||||
* Called to fill in the client capabilities this feature implements.
|
||||
*
|
||||
* @param capabilities The client capabilities to fill.
|
||||
*/
|
||||
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
||||
/**
|
||||
* Initialize the feature. This method is called on a feature instance
|
||||
* when the client has successfully received the initalize request from
|
||||
* the server and before the client sends the initialized notification
|
||||
* to the server.
|
||||
*
|
||||
* @param capabilities the server capabilities.
|
||||
* @param documentSelector the document selector pass to the client's constuctor.
|
||||
* May be `undefined` if the client was created without a selector.
|
||||
*/
|
||||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined): void;
|
||||
/**
|
||||
* Is called when the server send a register request for the given message.
|
||||
*
|
||||
* @param message the message to register for.
|
||||
* @param data additional registration data as defined in the protocol.
|
||||
*/
|
||||
register(message: RPCMessageType, data: RegistrationData<T>): void;
|
||||
/**
|
||||
* Is called when the server wants to unregister a feature.
|
||||
*
|
||||
* @param id the id used when registering the feature.
|
||||
*/
|
||||
unregister(id: string): void;
|
||||
/**
|
||||
* Called when the client is stopped to dispose this feature. Usually a feature
|
||||
* unregisters listeners registerd hooked up with the VS Code extension host.
|
||||
*/
|
||||
dispose(): void;
|
||||
}
|
||||
export declare abstract class TextDocumentFeature<T extends TextDocumentRegistrationOptions> implements DynamicFeature<T> {
|
||||
protected _client: BaseLanguageClient;
|
||||
private _message;
|
||||
protected _providers: Map<string, Disposable>;
|
||||
constructor(_client: BaseLanguageClient, _message: RPCMessageType);
|
||||
readonly messages: RPCMessageType;
|
||||
abstract fillClientCapabilities(capabilities: ClientCapabilities): void;
|
||||
abstract initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
||||
register(message: RPCMessageType, data: RegistrationData<T>): void;
|
||||
protected abstract registerLanguageProvider(options: T): Disposable;
|
||||
unregister(id: string): void;
|
||||
dispose(): void;
|
||||
}
|
||||
export interface MessageTransports {
|
||||
reader: MessageReader;
|
||||
writer: MessageWriter;
|
||||
detached?: boolean;
|
||||
}
|
||||
export declare namespace MessageTransports {
|
||||
function is(value: any): value is MessageTransports;
|
||||
}
|
||||
export declare abstract class BaseLanguageClient {
|
||||
private _id;
|
||||
private _name;
|
||||
private _clientOptions;
|
||||
private _state;
|
||||
private _onReady;
|
||||
private _onReadyCallbacks;
|
||||
private _onStop;
|
||||
private _connectionPromise;
|
||||
private _resolvedConnection;
|
||||
private _initializeResult;
|
||||
private _outputChannel;
|
||||
private _disposeOutputChannel;
|
||||
private _capabilities;
|
||||
private _listeners;
|
||||
private _providers;
|
||||
private _diagnostics;
|
||||
private _syncedDocuments;
|
||||
private _fileEvents;
|
||||
private _fileEventDelayer;
|
||||
private _telemetryEmitter;
|
||||
private _stateChangeEmitter;
|
||||
private _trace;
|
||||
private _tracer;
|
||||
private _c2p;
|
||||
private _p2c;
|
||||
constructor(id: string, name: string, clientOptions: LanguageClientOptions);
|
||||
private state;
|
||||
private getPublicState;
|
||||
readonly initializeResult: InitializeResult | undefined;
|
||||
sendRequest<R, E, RO>(type: RequestType0<R, E, RO>, token?: CancellationToken): Thenable<R>;
|
||||
sendRequest<P, R, E, RO>(type: RequestType<P, R, E, RO>, params: P, token?: CancellationToken): Thenable<R>;
|
||||
sendRequest<R>(method: string, token?: CancellationToken): Thenable<R>;
|
||||
sendRequest<R>(method: string, param: any, token?: CancellationToken): Thenable<R>;
|
||||
onRequest<R, E, RO>(type: RequestType0<R, E, RO>, handler: RequestHandler0<R, E>): void;
|
||||
onRequest<P, R, E, RO>(type: RequestType<P, R, E, RO>, handler: RequestHandler<P, R, E>): void;
|
||||
onRequest<R, E>(method: string, handler: GenericRequestHandler<R, E>): void;
|
||||
sendNotification<RO>(type: NotificationType0<RO>): void;
|
||||
sendNotification<P, RO>(type: NotificationType<P, RO>, params?: P): void;
|
||||
sendNotification(method: string): void;
|
||||
sendNotification(method: string, params: any): void;
|
||||
onNotification<RO>(type: NotificationType0<RO>, handler: NotificationHandler0): void;
|
||||
onNotification<P, RO>(type: NotificationType<P, RO>, handler: NotificationHandler<P>): void;
|
||||
onNotification(method: string, handler: GenericNotificationHandler): void;
|
||||
readonly clientOptions: LanguageClientOptions;
|
||||
readonly protocol2CodeConverter: p2c.Converter;
|
||||
readonly code2ProtocolConverter: c2p.Converter;
|
||||
readonly onTelemetry: Event<any>;
|
||||
readonly onDidChangeState: Event<StateChangeEvent>;
|
||||
readonly outputChannel: OutputChannel;
|
||||
readonly diagnostics: DiagnosticCollection | undefined;
|
||||
createDefaultErrorHandler(): ErrorHandler;
|
||||
trace: Trace;
|
||||
private data2String;
|
||||
info(message: string, data?: any): void;
|
||||
warn(message: string, data?: any): void;
|
||||
error(message: string, data?: any): void;
|
||||
private logTrace;
|
||||
needsStart(): boolean;
|
||||
needsStop(): boolean;
|
||||
onReady(): Promise<void>;
|
||||
private isConnectionActive;
|
||||
start(): Disposable;
|
||||
private resolveConnection;
|
||||
private initialize;
|
||||
private _clientGetRootPath;
|
||||
stop(): Thenable<void>;
|
||||
private cleanUp;
|
||||
private notifyFileEvent;
|
||||
private forceDocumentSync;
|
||||
private handleDiagnostics;
|
||||
private setDiagnostics;
|
||||
protected abstract createMessageTransports(encoding: string): Thenable<MessageTransports>;
|
||||
private createConnection;
|
||||
protected handleConnectionClosed(): void;
|
||||
private handleConnectionError;
|
||||
private hookConfigurationChanged;
|
||||
private refreshTrace;
|
||||
private hookFileEvents;
|
||||
private readonly _features;
|
||||
private readonly _method2Message;
|
||||
private readonly _dynamicFeatures;
|
||||
registerFeatures(features: (StaticFeature | DynamicFeature<any>)[]): void;
|
||||
registerFeature(feature: StaticFeature | DynamicFeature<any>): void;
|
||||
protected registerBuiltinFeatures(): void;
|
||||
private fillInitializeParams;
|
||||
private computeClientCapabilities;
|
||||
private initializeFeatures;
|
||||
private handleRegistrationRequest;
|
||||
private handleUnregistrationRequest;
|
||||
private handleApplyWorkspaceEdit;
|
||||
logFailedRequest(type: RPCMessageType, error: any): void;
|
||||
}
|
||||
2236
Client/node_modules/vscode-languageclient/lib/client.js
generated
vendored
Executable file
2236
Client/node_modules/vscode-languageclient/lib/client.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
43
Client/node_modules/vscode-languageclient/lib/codeConverter.d.ts
generated
vendored
Executable file
43
Client/node_modules/vscode-languageclient/lib/codeConverter.d.ts
generated
vendored
Executable file
@@ -0,0 +1,43 @@
|
||||
import * as code from 'vscode';
|
||||
import * as proto from 'vscode-languageserver-protocol';
|
||||
export interface Converter {
|
||||
asUri(uri: code.Uri): string;
|
||||
asTextDocumentIdentifier(textDocument: code.TextDocument): proto.TextDocumentIdentifier;
|
||||
asOpenTextDocumentParams(textDocument: code.TextDocument): proto.DidOpenTextDocumentParams;
|
||||
asChangeTextDocumentParams(textDocument: code.TextDocument): proto.DidChangeTextDocumentParams;
|
||||
asChangeTextDocumentParams(event: code.TextDocumentChangeEvent): proto.DidChangeTextDocumentParams;
|
||||
asCloseTextDocumentParams(textDocument: code.TextDocument): proto.DidCloseTextDocumentParams;
|
||||
asSaveTextDocumentParams(textDocument: code.TextDocument, includeContent?: boolean): proto.DidSaveTextDocumentParams;
|
||||
asWillSaveTextDocumentParams(event: code.TextDocumentWillSaveEvent): proto.WillSaveTextDocumentParams;
|
||||
asTextDocumentPositionParams(textDocument: code.TextDocument, position: code.Position): proto.TextDocumentPositionParams;
|
||||
asCompletionParams(textDocument: code.TextDocument, position: code.Position, context: code.CompletionContext): proto.CompletionParams;
|
||||
asWorkerPosition(position: code.Position): proto.Position;
|
||||
asPosition(value: code.Position): proto.Position;
|
||||
asPosition(value: undefined): undefined;
|
||||
asPosition(value: null): null;
|
||||
asPosition(value: code.Position | undefined | null): proto.Position | undefined | null;
|
||||
asRange(value: code.Range): proto.Range;
|
||||
asRange(value: undefined): undefined;
|
||||
asRange(value: null): null;
|
||||
asRange(value: code.Range | undefined | null): proto.Range | undefined | null;
|
||||
asDiagnosticSeverity(value: code.DiagnosticSeverity): number;
|
||||
asDiagnostic(item: code.Diagnostic): proto.Diagnostic;
|
||||
asDiagnostics(items: code.Diagnostic[]): proto.Diagnostic[];
|
||||
asCompletionItem(item: code.CompletionItem): proto.CompletionItem;
|
||||
asTextEdit(edit: code.TextEdit): proto.TextEdit;
|
||||
asReferenceParams(textDocument: code.TextDocument, position: code.Position, options: {
|
||||
includeDeclaration: boolean;
|
||||
}): proto.ReferenceParams;
|
||||
asCodeActionContext(context: code.CodeActionContext): proto.CodeActionContext;
|
||||
asCommand(item: code.Command): proto.Command;
|
||||
asCodeLens(item: code.CodeLens): proto.CodeLens;
|
||||
asFormattingOptions(item: code.FormattingOptions): proto.FormattingOptions;
|
||||
asDocumentSymbolParams(textDocument: code.TextDocument): proto.DocumentSymbolParams;
|
||||
asCodeLensParams(textDocument: code.TextDocument): proto.CodeLensParams;
|
||||
asDocumentLink(item: code.DocumentLink): proto.DocumentLink;
|
||||
asDocumentLinkParams(textDocument: code.TextDocument): proto.DocumentLinkParams;
|
||||
}
|
||||
export interface URIConverter {
|
||||
(value: code.Uri): string;
|
||||
}
|
||||
export declare function createConverter(uriConverter?: URIConverter): Converter;
|
||||
382
Client/node_modules/vscode-languageclient/lib/codeConverter.js
generated
vendored
Executable file
382
Client/node_modules/vscode-languageclient/lib/codeConverter.js
generated
vendored
Executable file
@@ -0,0 +1,382 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const code = require("vscode");
|
||||
const proto = require("vscode-languageserver-protocol");
|
||||
const Is = require("./utils/is");
|
||||
const protocolCompletionItem_1 = require("./protocolCompletionItem");
|
||||
const protocolCodeLens_1 = require("./protocolCodeLens");
|
||||
const protocolDocumentLink_1 = require("./protocolDocumentLink");
|
||||
function createConverter(uriConverter) {
|
||||
const nullConverter = (value) => value.toString();
|
||||
const _uriConverter = uriConverter || nullConverter;
|
||||
function asUri(value) {
|
||||
return _uriConverter(value);
|
||||
}
|
||||
function asTextDocumentIdentifier(textDocument) {
|
||||
return {
|
||||
uri: _uriConverter(textDocument.uri)
|
||||
};
|
||||
}
|
||||
function asVersionedTextDocumentIdentifier(textDocument) {
|
||||
return {
|
||||
uri: _uriConverter(textDocument.uri),
|
||||
version: textDocument.version
|
||||
};
|
||||
}
|
||||
function asOpenTextDocumentParams(textDocument) {
|
||||
return {
|
||||
textDocument: {
|
||||
uri: _uriConverter(textDocument.uri),
|
||||
languageId: textDocument.languageId,
|
||||
version: textDocument.version,
|
||||
text: textDocument.getText()
|
||||
}
|
||||
};
|
||||
}
|
||||
function isTextDocumentChangeEvent(value) {
|
||||
let candidate = value;
|
||||
return !!candidate.document && !!candidate.contentChanges;
|
||||
}
|
||||
function isTextDocument(value) {
|
||||
let candidate = value;
|
||||
return !!candidate.uri && !!candidate.version;
|
||||
}
|
||||
function asChangeTextDocumentParams(arg) {
|
||||
if (isTextDocument(arg)) {
|
||||
let result = {
|
||||
textDocument: {
|
||||
uri: _uriConverter(arg.uri),
|
||||
version: arg.version
|
||||
},
|
||||
contentChanges: [{ text: arg.getText() }]
|
||||
};
|
||||
return result;
|
||||
}
|
||||
else if (isTextDocumentChangeEvent(arg)) {
|
||||
let document = arg.document;
|
||||
let result = {
|
||||
textDocument: {
|
||||
uri: _uriConverter(document.uri),
|
||||
version: document.version
|
||||
},
|
||||
contentChanges: arg.contentChanges.map((change) => {
|
||||
let range = change.range;
|
||||
return {
|
||||
range: {
|
||||
start: { line: range.start.line, character: range.start.character },
|
||||
end: { line: range.end.line, character: range.end.character }
|
||||
},
|
||||
rangeLength: change.rangeLength,
|
||||
text: change.text
|
||||
};
|
||||
})
|
||||
};
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
throw Error('Unsupported text document change parameter');
|
||||
}
|
||||
}
|
||||
function asCloseTextDocumentParams(textDocument) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(textDocument)
|
||||
};
|
||||
}
|
||||
function asSaveTextDocumentParams(textDocument, includeContent = false) {
|
||||
let result = {
|
||||
textDocument: asVersionedTextDocumentIdentifier(textDocument)
|
||||
};
|
||||
if (includeContent) {
|
||||
result.text = textDocument.getText();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asTextDocumentSaveReason(reason) {
|
||||
switch (reason) {
|
||||
case code.TextDocumentSaveReason.Manual:
|
||||
return proto.TextDocumentSaveReason.Manual;
|
||||
case code.TextDocumentSaveReason.AfterDelay:
|
||||
return proto.TextDocumentSaveReason.AfterDelay;
|
||||
case code.TextDocumentSaveReason.FocusOut:
|
||||
return proto.TextDocumentSaveReason.FocusOut;
|
||||
}
|
||||
return proto.TextDocumentSaveReason.Manual;
|
||||
}
|
||||
function asWillSaveTextDocumentParams(event) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(event.document),
|
||||
reason: asTextDocumentSaveReason(event.reason)
|
||||
};
|
||||
}
|
||||
function asTextDocumentPositionParams(textDocument, position) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(textDocument),
|
||||
position: asWorkerPosition(position)
|
||||
};
|
||||
}
|
||||
function asTriggerKind(triggerKind) {
|
||||
switch (triggerKind) {
|
||||
case code.CompletionTriggerKind.TriggerCharacter:
|
||||
return proto.CompletionTriggerKind.TriggerCharacter;
|
||||
case code.CompletionTriggerKind.TriggerForIncompleteCompletions:
|
||||
return proto.CompletionTriggerKind.TriggerForIncompleteCompletions;
|
||||
default:
|
||||
return proto.CompletionTriggerKind.Invoked;
|
||||
}
|
||||
}
|
||||
function asCompletionParams(textDocument, position, context) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(textDocument),
|
||||
position: asWorkerPosition(position),
|
||||
context: {
|
||||
triggerKind: asTriggerKind(context.triggerKind),
|
||||
triggerCharacter: context.triggerCharacter
|
||||
}
|
||||
};
|
||||
}
|
||||
function asWorkerPosition(position) {
|
||||
return { line: position.line, character: position.character };
|
||||
}
|
||||
function asPosition(value) {
|
||||
if (value === void 0) {
|
||||
return undefined;
|
||||
}
|
||||
else if (value === null) {
|
||||
return null;
|
||||
}
|
||||
return { line: value.line, character: value.character };
|
||||
}
|
||||
function asRange(value) {
|
||||
if (value === void 0 || value === null) {
|
||||
return value;
|
||||
}
|
||||
return { start: asPosition(value.start), end: asPosition(value.end) };
|
||||
}
|
||||
function asDiagnosticSeverity(value) {
|
||||
switch (value) {
|
||||
case code.DiagnosticSeverity.Error:
|
||||
return proto.DiagnosticSeverity.Error;
|
||||
case code.DiagnosticSeverity.Warning:
|
||||
return proto.DiagnosticSeverity.Warning;
|
||||
case code.DiagnosticSeverity.Information:
|
||||
return proto.DiagnosticSeverity.Information;
|
||||
case code.DiagnosticSeverity.Hint:
|
||||
return proto.DiagnosticSeverity.Hint;
|
||||
}
|
||||
}
|
||||
function asDiagnostic(item) {
|
||||
let result = proto.Diagnostic.create(asRange(item.range), item.message);
|
||||
if (Is.number(item.severity)) {
|
||||
result.severity = asDiagnosticSeverity(item.severity);
|
||||
}
|
||||
if (Is.number(item.code) || Is.string(item.code)) {
|
||||
result.code = item.code;
|
||||
}
|
||||
if (item.source) {
|
||||
result.source = item.source;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asDiagnostics(items) {
|
||||
if (items === void 0 || items === null) {
|
||||
return items;
|
||||
}
|
||||
return items.map(asDiagnostic);
|
||||
}
|
||||
function asDocumentation(format, documentation) {
|
||||
switch (format) {
|
||||
case '$string':
|
||||
return documentation;
|
||||
case proto.MarkupKind.PlainText:
|
||||
return { kind: format, value: documentation };
|
||||
case proto.MarkupKind.Markdown:
|
||||
return { kind: format, value: documentation.value };
|
||||
default:
|
||||
return `Unsupported Markup content received. Kind is: ${format}`;
|
||||
}
|
||||
}
|
||||
function asCompletionItemKind(value, original) {
|
||||
if (original !== void 0) {
|
||||
return original;
|
||||
}
|
||||
return value + 1;
|
||||
}
|
||||
function asCompletionItem(item) {
|
||||
let result = { label: item.label };
|
||||
let protocolItem = item instanceof protocolCompletionItem_1.default ? item : undefined;
|
||||
if (item.detail) {
|
||||
result.detail = item.detail;
|
||||
}
|
||||
// We only send items back we created. So this can't be something else than
|
||||
// a string right now.
|
||||
if (item.documentation) {
|
||||
if (!protocolItem || protocolItem.documentationFormat === '$string') {
|
||||
result.documentation = item.documentation;
|
||||
}
|
||||
else {
|
||||
result.documentation = asDocumentation(protocolItem.documentationFormat, item.documentation);
|
||||
}
|
||||
}
|
||||
if (item.filterText) {
|
||||
result.filterText = item.filterText;
|
||||
}
|
||||
fillPrimaryInsertText(result, item);
|
||||
if (Is.number(item.kind)) {
|
||||
result.kind = asCompletionItemKind(item.kind, protocolItem && protocolItem.originalItemKind);
|
||||
}
|
||||
if (item.sortText) {
|
||||
result.sortText = item.sortText;
|
||||
}
|
||||
if (item.additionalTextEdits) {
|
||||
result.additionalTextEdits = asTextEdits(item.additionalTextEdits);
|
||||
}
|
||||
if (item.commitCharacters) {
|
||||
result.commitCharacters = item.commitCharacters.slice();
|
||||
}
|
||||
if (item.command) {
|
||||
result.command = asCommand(item.command);
|
||||
}
|
||||
if (item.preselect === true || item.preselect === false) {
|
||||
result.preselect = item.preselect;
|
||||
}
|
||||
if (protocolItem) {
|
||||
if (protocolItem.data !== void 0) {
|
||||
result.data = protocolItem.data;
|
||||
}
|
||||
if (protocolItem.deprecated === true || protocolItem.deprecated === false) {
|
||||
result.deprecated = protocolItem.deprecated;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function fillPrimaryInsertText(target, source) {
|
||||
let format = proto.InsertTextFormat.PlainText;
|
||||
let text;
|
||||
let range = undefined;
|
||||
if (source.textEdit) {
|
||||
text = source.textEdit.newText;
|
||||
range = asRange(source.textEdit.range);
|
||||
}
|
||||
else if (source.insertText instanceof code.SnippetString) {
|
||||
format = proto.InsertTextFormat.Snippet;
|
||||
text = source.insertText.value;
|
||||
}
|
||||
else {
|
||||
text = source.insertText;
|
||||
}
|
||||
if (source.range) {
|
||||
range = asRange(source.range);
|
||||
}
|
||||
target.insertTextFormat = format;
|
||||
if (source.fromEdit && text && range) {
|
||||
target.textEdit = { newText: text, range: range };
|
||||
}
|
||||
else {
|
||||
target.insertText = text;
|
||||
}
|
||||
}
|
||||
function asTextEdit(edit) {
|
||||
return { range: asRange(edit.range), newText: edit.newText };
|
||||
}
|
||||
function asTextEdits(edits) {
|
||||
if (edits === void 0 || edits === null) {
|
||||
return edits;
|
||||
}
|
||||
return edits.map(asTextEdit);
|
||||
}
|
||||
function asReferenceParams(textDocument, position, options) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(textDocument),
|
||||
position: asWorkerPosition(position),
|
||||
context: { includeDeclaration: options.includeDeclaration }
|
||||
};
|
||||
}
|
||||
function asCodeActionContext(context) {
|
||||
if (context === void 0 || context === null) {
|
||||
return context;
|
||||
}
|
||||
return proto.CodeActionContext.create(asDiagnostics(context.diagnostics), Is.string(context.only) ? [context.only] : undefined);
|
||||
}
|
||||
function asCommand(item) {
|
||||
let result = proto.Command.create(item.title, item.command);
|
||||
if (item.arguments) {
|
||||
result.arguments = item.arguments;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asCodeLens(item) {
|
||||
let result = proto.CodeLens.create(asRange(item.range));
|
||||
if (item.command) {
|
||||
result.command = asCommand(item.command);
|
||||
}
|
||||
if (item instanceof protocolCodeLens_1.default) {
|
||||
if (item.data) {
|
||||
result.data = item.data;
|
||||
}
|
||||
;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asFormattingOptions(item) {
|
||||
return { tabSize: item.tabSize, insertSpaces: item.insertSpaces };
|
||||
}
|
||||
function asDocumentSymbolParams(textDocument) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(textDocument)
|
||||
};
|
||||
}
|
||||
function asCodeLensParams(textDocument) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(textDocument)
|
||||
};
|
||||
}
|
||||
function asDocumentLink(item) {
|
||||
let result = proto.DocumentLink.create(asRange(item.range));
|
||||
if (item.target) {
|
||||
result.target = asUri(item.target);
|
||||
}
|
||||
let protocolItem = item instanceof protocolDocumentLink_1.default ? item : undefined;
|
||||
if (protocolItem && protocolItem.data) {
|
||||
result.data = protocolItem.data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asDocumentLinkParams(textDocument) {
|
||||
return {
|
||||
textDocument: asTextDocumentIdentifier(textDocument)
|
||||
};
|
||||
}
|
||||
return {
|
||||
asUri,
|
||||
asTextDocumentIdentifier,
|
||||
asOpenTextDocumentParams,
|
||||
asChangeTextDocumentParams,
|
||||
asCloseTextDocumentParams,
|
||||
asSaveTextDocumentParams,
|
||||
asWillSaveTextDocumentParams,
|
||||
asTextDocumentPositionParams,
|
||||
asCompletionParams,
|
||||
asWorkerPosition,
|
||||
asRange,
|
||||
asPosition,
|
||||
asDiagnosticSeverity,
|
||||
asDiagnostic,
|
||||
asDiagnostics,
|
||||
asCompletionItem,
|
||||
asTextEdit,
|
||||
asReferenceParams,
|
||||
asCodeActionContext,
|
||||
asCommand,
|
||||
asCodeLens,
|
||||
asFormattingOptions,
|
||||
asDocumentSymbolParams,
|
||||
asCodeLensParams,
|
||||
asDocumentLink,
|
||||
asDocumentLinkParams
|
||||
};
|
||||
}
|
||||
exports.createConverter = createConverter;
|
||||
28
Client/node_modules/vscode-languageclient/lib/colorProvider.d.ts
generated
vendored
Executable file
28
Client/node_modules/vscode-languageclient/lib/colorProvider.d.ts
generated
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
import { Disposable, TextDocument, ProviderResult, Range as VRange, Color as VColor, ColorPresentation as VColorPresentation, ColorInformation as VColorInformation } from 'vscode';
|
||||
import { ClientCapabilities, CancellationToken, ServerCapabilities, TextDocumentRegistrationOptions, DocumentSelector } from 'vscode-languageserver-protocol';
|
||||
import { TextDocumentFeature, BaseLanguageClient } from './client';
|
||||
export interface ProvideDocumentColorsSignature {
|
||||
(document: TextDocument, token: CancellationToken): ProviderResult<VColorInformation[]>;
|
||||
}
|
||||
export interface ProvideColorPresentationSignature {
|
||||
(color: VColor, context: {
|
||||
document: TextDocument;
|
||||
range: VRange;
|
||||
}, token: CancellationToken): ProviderResult<VColorPresentation[]>;
|
||||
}
|
||||
export interface ColorProviderMiddleware {
|
||||
provideDocumentColors?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideDocumentColorsSignature) => ProviderResult<VColorInformation[]>;
|
||||
provideColorPresentations?: (this: void, color: VColor, context: {
|
||||
document: TextDocument;
|
||||
range: VRange;
|
||||
}, token: CancellationToken, next: ProvideColorPresentationSignature) => ProviderResult<VColorPresentation[]>;
|
||||
}
|
||||
export declare class ColorProviderFeature extends TextDocumentFeature<TextDocumentRegistrationOptions> {
|
||||
constructor(client: BaseLanguageClient);
|
||||
fillClientCapabilities(capabilites: ClientCapabilities): void;
|
||||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
||||
protected registerLanguageProvider(options: TextDocumentRegistrationOptions): Disposable;
|
||||
private asColor;
|
||||
private asColorInformations;
|
||||
private asColorPresentations;
|
||||
}
|
||||
98
Client/node_modules/vscode-languageclient/lib/colorProvider.js
generated
vendored
Executable file
98
Client/node_modules/vscode-languageclient/lib/colorProvider.js
generated
vendored
Executable file
@@ -0,0 +1,98 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const UUID = require("./utils/uuid");
|
||||
const Is = require("./utils/is");
|
||||
const vscode_1 = require("vscode");
|
||||
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
||||
const client_1 = require("./client");
|
||||
function ensure(target, key) {
|
||||
if (target[key] === void 0) {
|
||||
target[key] = {};
|
||||
}
|
||||
return target[key];
|
||||
}
|
||||
class ColorProviderFeature extends client_1.TextDocumentFeature {
|
||||
constructor(client) {
|
||||
super(client, vscode_languageserver_protocol_1.DocumentColorRequest.type);
|
||||
}
|
||||
fillClientCapabilities(capabilites) {
|
||||
ensure(ensure(capabilites, 'textDocument'), 'colorProvider').dynamicRegistration = true;
|
||||
}
|
||||
initialize(capabilities, documentSelector) {
|
||||
if (!capabilities.colorProvider) {
|
||||
return;
|
||||
}
|
||||
const implCapabilities = capabilities.colorProvider;
|
||||
const id = Is.string(implCapabilities.id) && implCapabilities.id.length > 0 ? implCapabilities.id : UUID.generateUuid();
|
||||
const selector = implCapabilities.documentSelector || documentSelector;
|
||||
if (selector) {
|
||||
this.register(this.messages, {
|
||||
id,
|
||||
registerOptions: Object.assign({}, { documentSelector: selector })
|
||||
});
|
||||
}
|
||||
}
|
||||
registerLanguageProvider(options) {
|
||||
let client = this._client;
|
||||
let provideColorPresentations = (color, context, token) => {
|
||||
const requestParams = {
|
||||
color,
|
||||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(context.document),
|
||||
range: client.code2ProtocolConverter.asRange(context.range)
|
||||
};
|
||||
return client.sendRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, requestParams, token).then(this.asColorPresentations.bind(this), (error) => {
|
||||
client.logFailedRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, error);
|
||||
return Promise.resolve(null);
|
||||
});
|
||||
};
|
||||
let provideDocumentColors = (document, token) => {
|
||||
const requestParams = {
|
||||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document)
|
||||
};
|
||||
return client.sendRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, requestParams, token).then(this.asColorInformations.bind(this), (error) => {
|
||||
client.logFailedRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, error);
|
||||
return Promise.resolve(null);
|
||||
});
|
||||
};
|
||||
let middleware = client.clientOptions.middleware;
|
||||
return vscode_1.languages.registerColorProvider(options.documentSelector, {
|
||||
provideColorPresentations: (color, context, token) => {
|
||||
return middleware.provideColorPresentations
|
||||
? middleware.provideColorPresentations(color, context, token, provideColorPresentations)
|
||||
: provideColorPresentations(color, context, token);
|
||||
},
|
||||
provideDocumentColors: (document, token) => {
|
||||
return middleware.provideDocumentColors
|
||||
? middleware.provideDocumentColors(document, token, provideDocumentColors)
|
||||
: provideDocumentColors(document, token);
|
||||
}
|
||||
});
|
||||
}
|
||||
asColor(color) {
|
||||
return new vscode_1.Color(color.red, color.green, color.blue, color.alpha);
|
||||
}
|
||||
asColorInformations(colorInformation) {
|
||||
if (Array.isArray(colorInformation)) {
|
||||
return colorInformation.map(ci => {
|
||||
return new vscode_1.ColorInformation(this._client.protocol2CodeConverter.asRange(ci.range), this.asColor(ci.color));
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
asColorPresentations(colorPresentations) {
|
||||
if (Array.isArray(colorPresentations)) {
|
||||
return colorPresentations.map(cp => {
|
||||
let presentation = new vscode_1.ColorPresentation(cp.label);
|
||||
presentation.additionalTextEdits = this._client.protocol2CodeConverter.asTextEdits(cp.additionalTextEdits);
|
||||
presentation.textEdit = this._client.protocol2CodeConverter.asTextEdit(cp.textEdit);
|
||||
return presentation;
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
exports.ColorProviderFeature = ColorProviderFeature;
|
||||
12
Client/node_modules/vscode-languageclient/lib/configuration.d.ts
generated
vendored
Executable file
12
Client/node_modules/vscode-languageclient/lib/configuration.d.ts
generated
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
import { StaticFeature, BaseLanguageClient } from './client';
|
||||
import { ClientCapabilities, ConfigurationRequest } from 'vscode-languageserver-protocol';
|
||||
export interface ConfigurationWorkspaceMiddleware {
|
||||
configuration?: ConfigurationRequest.MiddlewareSignature;
|
||||
}
|
||||
export declare class ConfigurationFeature implements StaticFeature {
|
||||
private _client;
|
||||
constructor(_client: BaseLanguageClient);
|
||||
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
||||
initialize(): void;
|
||||
private getConfiguration;
|
||||
}
|
||||
63
Client/node_modules/vscode-languageclient/lib/configuration.js
generated
vendored
Executable file
63
Client/node_modules/vscode-languageclient/lib/configuration.js
generated
vendored
Executable file
@@ -0,0 +1,63 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const vscode_1 = require("vscode");
|
||||
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
||||
class ConfigurationFeature {
|
||||
constructor(_client) {
|
||||
this._client = _client;
|
||||
}
|
||||
fillClientCapabilities(capabilities) {
|
||||
capabilities.workspace = capabilities.workspace || {};
|
||||
capabilities.workspace.configuration = true;
|
||||
}
|
||||
initialize() {
|
||||
let client = this._client;
|
||||
client.onRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, (params, token) => {
|
||||
let configuration = (params) => {
|
||||
let result = [];
|
||||
for (let item of params.items) {
|
||||
let resource = item.scopeUri !== void 0 && item.scopeUri !== null ? this._client.protocol2CodeConverter.asUri(item.scopeUri) : undefined;
|
||||
result.push(this.getConfiguration(resource, item.section !== null ? item.section : undefined));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
let middleware = client.clientOptions.middleware.workspace;
|
||||
return middleware && middleware.configuration
|
||||
? middleware.configuration(params, token, configuration)
|
||||
: configuration(params, token);
|
||||
});
|
||||
}
|
||||
getConfiguration(resource, section) {
|
||||
let result = null;
|
||||
if (section) {
|
||||
let index = section.lastIndexOf('.');
|
||||
if (index === -1) {
|
||||
result = vscode_1.workspace.getConfiguration(undefined, resource).get(section);
|
||||
}
|
||||
else {
|
||||
let config = vscode_1.workspace.getConfiguration(section.substr(0, index));
|
||||
if (config) {
|
||||
result = config.get(section.substr(index + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
let config = vscode_1.workspace.getConfiguration(undefined, resource);
|
||||
result = {};
|
||||
for (let key of Object.keys(config)) {
|
||||
if (config.has(key)) {
|
||||
result[key] = config.get(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.ConfigurationFeature = ConfigurationFeature;
|
||||
17
Client/node_modules/vscode-languageclient/lib/foldingRange.d.ts
generated
vendored
Executable file
17
Client/node_modules/vscode-languageclient/lib/foldingRange.d.ts
generated
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
import { Disposable, TextDocument, ProviderResult, FoldingRange as VFoldingRange, FoldingContext } from 'vscode';
|
||||
import { ClientCapabilities, CancellationToken, ServerCapabilities, TextDocumentRegistrationOptions, DocumentSelector } from 'vscode-languageserver-protocol';
|
||||
import { TextDocumentFeature, BaseLanguageClient } from './client';
|
||||
export interface ProvideFoldingRangeSignature {
|
||||
(document: TextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<VFoldingRange[]>;
|
||||
}
|
||||
export interface FoldingRangeProviderMiddleware {
|
||||
provideFoldingRanges?: (this: void, document: TextDocument, context: FoldingContext, token: CancellationToken, next: ProvideFoldingRangeSignature) => ProviderResult<VFoldingRange[]>;
|
||||
}
|
||||
export declare class FoldingRangeFeature extends TextDocumentFeature<TextDocumentRegistrationOptions> {
|
||||
constructor(client: BaseLanguageClient);
|
||||
fillClientCapabilities(capabilites: ClientCapabilities): void;
|
||||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
||||
protected registerLanguageProvider(options: TextDocumentRegistrationOptions): Disposable;
|
||||
private asFoldingRangeKind;
|
||||
private asFoldingRanges;
|
||||
}
|
||||
84
Client/node_modules/vscode-languageclient/lib/foldingRange.js
generated
vendored
Executable file
84
Client/node_modules/vscode-languageclient/lib/foldingRange.js
generated
vendored
Executable file
@@ -0,0 +1,84 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const UUID = require("./utils/uuid");
|
||||
const Is = require("./utils/is");
|
||||
const vscode_1 = require("vscode");
|
||||
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
||||
const client_1 = require("./client");
|
||||
function ensure(target, key) {
|
||||
if (target[key] === void 0) {
|
||||
target[key] = {};
|
||||
}
|
||||
return target[key];
|
||||
}
|
||||
class FoldingRangeFeature extends client_1.TextDocumentFeature {
|
||||
constructor(client) {
|
||||
super(client, vscode_languageserver_protocol_1.FoldingRangeRequest.type);
|
||||
}
|
||||
fillClientCapabilities(capabilites) {
|
||||
let capability = ensure(ensure(capabilites, 'textDocument'), 'foldingRange');
|
||||
capability.dynamicRegistration = true;
|
||||
capability.rangeLimit = 5000;
|
||||
capability.lineFoldingOnly = true;
|
||||
}
|
||||
initialize(capabilities, documentSelector) {
|
||||
if (!capabilities.foldingRangeProvider) {
|
||||
return;
|
||||
}
|
||||
const implCapabilities = capabilities.foldingRangeProvider;
|
||||
const id = Is.string(implCapabilities.id) && implCapabilities.id.length > 0 ? implCapabilities.id : UUID.generateUuid();
|
||||
const selector = implCapabilities.documentSelector || documentSelector;
|
||||
if (selector) {
|
||||
this.register(this.messages, {
|
||||
id,
|
||||
registerOptions: Object.assign({}, { documentSelector: selector })
|
||||
});
|
||||
}
|
||||
}
|
||||
registerLanguageProvider(options) {
|
||||
let client = this._client;
|
||||
let provideFoldingRanges = (document, _, token) => {
|
||||
const requestParams = {
|
||||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document)
|
||||
};
|
||||
return client.sendRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, requestParams, token).then(this.asFoldingRanges.bind(this), (error) => {
|
||||
client.logFailedRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, error);
|
||||
return Promise.resolve(null);
|
||||
});
|
||||
};
|
||||
let middleware = client.clientOptions.middleware;
|
||||
return vscode_1.languages.registerFoldingRangeProvider(options.documentSelector, {
|
||||
provideFoldingRanges(document, context, token) {
|
||||
return middleware.provideFoldingRanges
|
||||
? middleware.provideFoldingRanges(document, context, token, provideFoldingRanges)
|
||||
: provideFoldingRanges(document, context, token);
|
||||
}
|
||||
});
|
||||
}
|
||||
asFoldingRangeKind(kind) {
|
||||
if (kind) {
|
||||
switch (kind) {
|
||||
case vscode_languageserver_protocol_1.FoldingRangeKind.Comment:
|
||||
return vscode_1.FoldingRangeKind.Comment;
|
||||
case vscode_languageserver_protocol_1.FoldingRangeKind.Imports:
|
||||
return vscode_1.FoldingRangeKind.Imports;
|
||||
case vscode_languageserver_protocol_1.FoldingRangeKind.Region:
|
||||
return vscode_1.FoldingRangeKind.Region;
|
||||
}
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
asFoldingRanges(foldingRanges) {
|
||||
if (Array.isArray(foldingRanges)) {
|
||||
return foldingRanges.map(r => {
|
||||
return new vscode_1.FoldingRange(r.startLine, r.endLine, this.asFoldingRangeKind(r.kind));
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
exports.FoldingRangeFeature = FoldingRangeFeature;
|
||||
15
Client/node_modules/vscode-languageclient/lib/implementation.d.ts
generated
vendored
Executable file
15
Client/node_modules/vscode-languageclient/lib/implementation.d.ts
generated
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Definition as VDefinition } from 'vscode';
|
||||
import { ClientCapabilities, CancellationToken, ServerCapabilities, TextDocumentRegistrationOptions, DocumentSelector } from 'vscode-languageserver-protocol';
|
||||
import { TextDocumentFeature, BaseLanguageClient } from './client';
|
||||
export interface ProvideImplementationSignature {
|
||||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition>;
|
||||
}
|
||||
export interface ImplementationMiddleware {
|
||||
provideImplementation?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideImplementationSignature) => ProviderResult<VDefinition>;
|
||||
}
|
||||
export declare class ImplementationFeature extends TextDocumentFeature<TextDocumentRegistrationOptions> {
|
||||
constructor(client: BaseLanguageClient);
|
||||
fillClientCapabilities(capabilites: ClientCapabilities): void;
|
||||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
||||
protected registerLanguageProvider(options: TextDocumentRegistrationOptions): Disposable;
|
||||
}
|
||||
68
Client/node_modules/vscode-languageclient/lib/implementation.js
generated
vendored
Executable file
68
Client/node_modules/vscode-languageclient/lib/implementation.js
generated
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const UUID = require("./utils/uuid");
|
||||
const Is = require("./utils/is");
|
||||
const vscode_1 = require("vscode");
|
||||
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
||||
const client_1 = require("./client");
|
||||
function ensure(target, key) {
|
||||
if (target[key] === void 0) {
|
||||
target[key] = {};
|
||||
}
|
||||
return target[key];
|
||||
}
|
||||
class ImplementationFeature extends client_1.TextDocumentFeature {
|
||||
constructor(client) {
|
||||
super(client, vscode_languageserver_protocol_1.ImplementationRequest.type);
|
||||
}
|
||||
fillClientCapabilities(capabilites) {
|
||||
ensure(ensure(capabilites, 'textDocument'), 'implementation').dynamicRegistration = true;
|
||||
}
|
||||
initialize(capabilities, documentSelector) {
|
||||
if (!capabilities.implementationProvider) {
|
||||
return;
|
||||
}
|
||||
if (capabilities.implementationProvider === true) {
|
||||
if (!documentSelector) {
|
||||
return;
|
||||
}
|
||||
this.register(this.messages, {
|
||||
id: UUID.generateUuid(),
|
||||
registerOptions: Object.assign({}, { documentSelector: documentSelector })
|
||||
});
|
||||
}
|
||||
else {
|
||||
const implCapabilities = capabilities.implementationProvider;
|
||||
const id = Is.string(implCapabilities.id) && implCapabilities.id.length > 0 ? implCapabilities.id : UUID.generateUuid();
|
||||
const selector = implCapabilities.documentSelector || documentSelector;
|
||||
if (selector) {
|
||||
this.register(this.messages, {
|
||||
id,
|
||||
registerOptions: Object.assign({}, { documentSelector: selector })
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
registerLanguageProvider(options) {
|
||||
let client = this._client;
|
||||
let provideImplementation = (document, position, token) => {
|
||||
return client.sendRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDefinitionResult, (error) => {
|
||||
client.logFailedRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, error);
|
||||
return Promise.resolve(null);
|
||||
});
|
||||
};
|
||||
let middleware = client.clientOptions.middleware;
|
||||
return vscode_1.languages.registerImplementationProvider(options.documentSelector, {
|
||||
provideImplementation: (document, position, token) => {
|
||||
return middleware.provideImplementation
|
||||
? middleware.provideImplementation(document, position, token, provideImplementation)
|
||||
: provideImplementation(document, position, token);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ImplementationFeature = ImplementationFeature;
|
||||
96
Client/node_modules/vscode-languageclient/lib/main.d.ts
generated
vendored
Executable file
96
Client/node_modules/vscode-languageclient/lib/main.d.ts
generated
vendored
Executable file
@@ -0,0 +1,96 @@
|
||||
/// <reference types="node" />
|
||||
import * as cp from 'child_process';
|
||||
import ChildProcess = cp.ChildProcess;
|
||||
import { BaseLanguageClient, LanguageClientOptions, MessageTransports, StaticFeature, DynamicFeature } from './client';
|
||||
import { Disposable } from 'vscode';
|
||||
export * from './client';
|
||||
export interface ExecutableOptions {
|
||||
cwd?: string;
|
||||
stdio?: string | string[];
|
||||
env?: any;
|
||||
detached?: boolean;
|
||||
shell?: boolean;
|
||||
}
|
||||
export interface Executable {
|
||||
command: string;
|
||||
args?: string[];
|
||||
options?: ExecutableOptions;
|
||||
}
|
||||
export interface ForkOptions {
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
encoding?: string;
|
||||
execArgv?: string[];
|
||||
}
|
||||
export declare enum TransportKind {
|
||||
stdio = 0,
|
||||
ipc = 1,
|
||||
pipe = 2,
|
||||
socket = 3
|
||||
}
|
||||
export interface SocketTransport {
|
||||
kind: TransportKind.socket;
|
||||
port: number;
|
||||
}
|
||||
/**
|
||||
* To avoid any timing, pipe name or port number issues the pipe (TransportKind.pipe)
|
||||
* and the sockets (TransportKind.socket and SocketTransport) are owned by the
|
||||
* VS Code processes. The server process simply connects to the pipe / socket.
|
||||
* In node term the VS Code process calls `createServer`, then starts the server
|
||||
* process, waits until the server process has connected to the pipe / socket
|
||||
* and then signals that the connection has been established and messages can
|
||||
* be send back and forth. If the language server is implemented in a different
|
||||
* programm language the server simply needs to create a connection to the
|
||||
* passed pipe name or port number.
|
||||
*/
|
||||
export declare type Transport = TransportKind | SocketTransport;
|
||||
export interface NodeModule {
|
||||
module: string;
|
||||
transport?: Transport;
|
||||
args?: string[];
|
||||
runtime?: string;
|
||||
options?: ForkOptions;
|
||||
}
|
||||
export interface StreamInfo {
|
||||
writer: NodeJS.WritableStream;
|
||||
reader: NodeJS.ReadableStream;
|
||||
detached?: boolean;
|
||||
}
|
||||
export interface ChildProcessInfo {
|
||||
process: ChildProcess;
|
||||
detached: boolean;
|
||||
}
|
||||
export declare type ServerOptions = Executable | {
|
||||
run: Executable;
|
||||
debug: Executable;
|
||||
} | {
|
||||
run: NodeModule;
|
||||
debug: NodeModule;
|
||||
} | NodeModule | (() => Thenable<ChildProcess | StreamInfo | MessageTransports | ChildProcessInfo>);
|
||||
export declare class LanguageClient extends BaseLanguageClient {
|
||||
private _serverOptions;
|
||||
private _forceDebug;
|
||||
private _serverProcess;
|
||||
private _isDetached;
|
||||
constructor(name: string, serverOptions: ServerOptions, clientOptions: LanguageClientOptions, forceDebug?: boolean);
|
||||
constructor(id: string, name: string, serverOptions: ServerOptions, clientOptions: LanguageClientOptions, forceDebug?: boolean);
|
||||
stop(): Thenable<void>;
|
||||
private checkProcessDied;
|
||||
protected handleConnectionClosed(): void;
|
||||
protected createMessageTransports(encoding: string): Thenable<MessageTransports>;
|
||||
registerProposedFeatures(): void;
|
||||
protected registerBuiltinFeatures(): void;
|
||||
private _mainGetRootPath;
|
||||
private _getServerWorkingDir;
|
||||
}
|
||||
export declare class SettingMonitor {
|
||||
private _client;
|
||||
private _setting;
|
||||
private _listeners;
|
||||
constructor(_client: LanguageClient, _setting: string);
|
||||
start(): Disposable;
|
||||
private onDidChangeConfiguration;
|
||||
}
|
||||
export declare namespace ProposedFeatures {
|
||||
function createAll(_client: BaseLanguageClient): (StaticFeature | DynamicFeature<any>)[];
|
||||
}
|
||||
438
Client/node_modules/vscode-languageclient/lib/main.js
generated
vendored
Executable file
438
Client/node_modules/vscode-languageclient/lib/main.js
generated
vendored
Executable file
@@ -0,0 +1,438 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const cp = require("child_process");
|
||||
const fs = require("fs");
|
||||
const client_1 = require("./client");
|
||||
const vscode_1 = require("vscode");
|
||||
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
||||
const colorProvider_1 = require("./colorProvider");
|
||||
const configuration_1 = require("./configuration");
|
||||
const implementation_1 = require("./implementation");
|
||||
const typeDefinition_1 = require("./typeDefinition");
|
||||
const workspaceFolders_1 = require("./workspaceFolders");
|
||||
const foldingRange_1 = require("./foldingRange");
|
||||
const Is = require("./utils/is");
|
||||
const electron = require("./utils/electron");
|
||||
const processes_1 = require("./utils/processes");
|
||||
__export(require("./client"));
|
||||
var Executable;
|
||||
(function (Executable) {
|
||||
function is(value) {
|
||||
return Is.string(value.command);
|
||||
}
|
||||
Executable.is = is;
|
||||
})(Executable || (Executable = {}));
|
||||
var TransportKind;
|
||||
(function (TransportKind) {
|
||||
TransportKind[TransportKind["stdio"] = 0] = "stdio";
|
||||
TransportKind[TransportKind["ipc"] = 1] = "ipc";
|
||||
TransportKind[TransportKind["pipe"] = 2] = "pipe";
|
||||
TransportKind[TransportKind["socket"] = 3] = "socket";
|
||||
})(TransportKind = exports.TransportKind || (exports.TransportKind = {}));
|
||||
var Transport;
|
||||
(function (Transport) {
|
||||
function isSocket(value) {
|
||||
let candidate = value;
|
||||
return candidate && candidate.kind === TransportKind.socket && Is.number(candidate.port);
|
||||
}
|
||||
Transport.isSocket = isSocket;
|
||||
})(Transport || (Transport = {}));
|
||||
var NodeModule;
|
||||
(function (NodeModule) {
|
||||
function is(value) {
|
||||
return Is.string(value.module);
|
||||
}
|
||||
NodeModule.is = is;
|
||||
})(NodeModule || (NodeModule = {}));
|
||||
var StreamInfo;
|
||||
(function (StreamInfo) {
|
||||
function is(value) {
|
||||
let candidate = value;
|
||||
return candidate && candidate.writer !== void 0 && candidate.reader !== void 0;
|
||||
}
|
||||
StreamInfo.is = is;
|
||||
})(StreamInfo || (StreamInfo = {}));
|
||||
var ChildProcessInfo;
|
||||
(function (ChildProcessInfo) {
|
||||
function is(value) {
|
||||
let candidate = value;
|
||||
return candidate && candidate.process !== void 0 && typeof candidate.detached === 'boolean';
|
||||
}
|
||||
ChildProcessInfo.is = is;
|
||||
})(ChildProcessInfo || (ChildProcessInfo = {}));
|
||||
class LanguageClient extends client_1.BaseLanguageClient {
|
||||
constructor(arg1, arg2, arg3, arg4, arg5) {
|
||||
let id;
|
||||
let name;
|
||||
let serverOptions;
|
||||
let clientOptions;
|
||||
let forceDebug;
|
||||
if (Is.string(arg2)) {
|
||||
id = arg1;
|
||||
name = arg2;
|
||||
serverOptions = arg3;
|
||||
clientOptions = arg4;
|
||||
forceDebug = !!arg5;
|
||||
}
|
||||
else {
|
||||
id = arg1.toLowerCase();
|
||||
name = arg1;
|
||||
serverOptions = arg2;
|
||||
clientOptions = arg3;
|
||||
forceDebug = arg4;
|
||||
}
|
||||
if (forceDebug === void 0) {
|
||||
forceDebug = false;
|
||||
}
|
||||
super(id, name, clientOptions);
|
||||
this._serverOptions = serverOptions;
|
||||
this._forceDebug = forceDebug;
|
||||
}
|
||||
stop() {
|
||||
return super.stop().then(() => {
|
||||
if (this._serverProcess) {
|
||||
let toCheck = this._serverProcess;
|
||||
this._serverProcess = undefined;
|
||||
if (this._isDetached === void 0 || !this._isDetached) {
|
||||
this.checkProcessDied(toCheck);
|
||||
}
|
||||
this._isDetached = undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
checkProcessDied(childProcess) {
|
||||
if (!childProcess) {
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
// Test if the process is still alive. Throws an exception if not
|
||||
try {
|
||||
process.kill(childProcess.pid, 0);
|
||||
processes_1.terminate(childProcess);
|
||||
}
|
||||
catch (error) {
|
||||
// All is fine.
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
handleConnectionClosed() {
|
||||
this._serverProcess = undefined;
|
||||
super.handleConnectionClosed();
|
||||
}
|
||||
createMessageTransports(encoding) {
|
||||
function getEnvironment(env) {
|
||||
if (!env) {
|
||||
return process.env;
|
||||
}
|
||||
let result = Object.create(null);
|
||||
Object.keys(process.env).forEach(key => result[key] = process.env[key]);
|
||||
Object.keys(env).forEach(key => result[key] = env[key]);
|
||||
return result;
|
||||
}
|
||||
function startedInDebugMode() {
|
||||
let args = process.execArgv;
|
||||
if (args) {
|
||||
return args.some((arg) => /^--debug=?/.test(arg) || /^--debug-brk=?/.test(arg) || /^--inspect=?/.test(arg) || /^--inspect-brk=?/.test(arg));
|
||||
}
|
||||
;
|
||||
return false;
|
||||
}
|
||||
let server = this._serverOptions;
|
||||
// We got a function.
|
||||
if (Is.func(server)) {
|
||||
return server().then((result) => {
|
||||
if (client_1.MessageTransports.is(result)) {
|
||||
this._isDetached = !!result.detached;
|
||||
return result;
|
||||
}
|
||||
else if (StreamInfo.is(result)) {
|
||||
this._isDetached = !!result.detached;
|
||||
return { reader: new vscode_languageserver_protocol_1.StreamMessageReader(result.reader), writer: new vscode_languageserver_protocol_1.StreamMessageWriter(result.writer) };
|
||||
}
|
||||
else {
|
||||
let cp;
|
||||
if (ChildProcessInfo.is(result)) {
|
||||
cp = result.process;
|
||||
this._isDetached = result.detached;
|
||||
}
|
||||
else {
|
||||
cp = result;
|
||||
this._isDetached = false;
|
||||
}
|
||||
cp.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
return { reader: new vscode_languageserver_protocol_1.StreamMessageReader(cp.stdout), writer: new vscode_languageserver_protocol_1.StreamMessageWriter(cp.stdin) };
|
||||
}
|
||||
});
|
||||
}
|
||||
let json;
|
||||
let runDebug = server;
|
||||
if (runDebug.run || runDebug.debug) {
|
||||
// We are under debugging. So use debug as well.
|
||||
if (typeof v8debug === 'object' || this._forceDebug || startedInDebugMode()) {
|
||||
json = runDebug.debug;
|
||||
}
|
||||
else {
|
||||
json = runDebug.run;
|
||||
}
|
||||
}
|
||||
else {
|
||||
json = server;
|
||||
}
|
||||
return this._getServerWorkingDir(json.options).then(serverWorkingDir => {
|
||||
if (NodeModule.is(json) && json.module) {
|
||||
let node = json;
|
||||
let transport = node.transport || TransportKind.stdio;
|
||||
if (node.runtime) {
|
||||
let args = [];
|
||||
let options = node.options || Object.create(null);
|
||||
if (options.execArgv) {
|
||||
options.execArgv.forEach(element => args.push(element));
|
||||
}
|
||||
args.push(node.module);
|
||||
if (node.args) {
|
||||
node.args.forEach(element => args.push(element));
|
||||
}
|
||||
let execOptions = Object.create(null);
|
||||
execOptions.cwd = serverWorkingDir;
|
||||
execOptions.env = getEnvironment(options.env);
|
||||
let pipeName = undefined;
|
||||
if (transport === TransportKind.ipc) {
|
||||
// exec options not correctly typed in lib
|
||||
execOptions.stdio = [null, null, null, 'ipc'];
|
||||
args.push('--node-ipc');
|
||||
}
|
||||
else if (transport === TransportKind.stdio) {
|
||||
args.push('--stdio');
|
||||
}
|
||||
else if (transport === TransportKind.pipe) {
|
||||
pipeName = vscode_languageserver_protocol_1.generateRandomPipeName();
|
||||
args.push(`--pipe=${pipeName}`);
|
||||
}
|
||||
else if (Transport.isSocket(transport)) {
|
||||
args.push(`--socket=${transport.port}`);
|
||||
}
|
||||
args.push(`--clientProcessId=${process.pid.toString()}`);
|
||||
if (transport === TransportKind.ipc || transport === TransportKind.stdio) {
|
||||
let serverProcess = cp.spawn(node.runtime, args, execOptions);
|
||||
if (!serverProcess || !serverProcess.pid) {
|
||||
return Promise.reject(`Launching server using runtime ${node.runtime} failed.`);
|
||||
}
|
||||
this._serverProcess = serverProcess;
|
||||
serverProcess.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
if (transport === TransportKind.ipc) {
|
||||
serverProcess.stdout.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
return Promise.resolve({ reader: new vscode_languageserver_protocol_1.IPCMessageReader(serverProcess), writer: new vscode_languageserver_protocol_1.IPCMessageWriter(serverProcess) });
|
||||
}
|
||||
else {
|
||||
return Promise.resolve({ reader: new vscode_languageserver_protocol_1.StreamMessageReader(serverProcess.stdout), writer: new vscode_languageserver_protocol_1.StreamMessageWriter(serverProcess.stdin) });
|
||||
}
|
||||
}
|
||||
else if (transport == TransportKind.pipe) {
|
||||
return vscode_languageserver_protocol_1.createClientPipeTransport(pipeName).then((transport) => {
|
||||
let process = cp.spawn(node.runtime, args, execOptions);
|
||||
if (!process || !process.pid) {
|
||||
return Promise.reject(`Launching server using runtime ${node.runtime} failed.`);
|
||||
}
|
||||
this._serverProcess = process;
|
||||
process.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
process.stdout.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
return transport.onConnected().then((protocol) => {
|
||||
return { reader: protocol[0], writer: protocol[1] };
|
||||
});
|
||||
});
|
||||
}
|
||||
else if (Transport.isSocket(transport)) {
|
||||
return vscode_languageserver_protocol_1.createClientSocketTransport(transport.port).then((transport) => {
|
||||
let process = cp.spawn(node.runtime, args, execOptions);
|
||||
if (!process || !process.pid) {
|
||||
return Promise.reject(`Launching server using runtime ${node.runtime} failed.`);
|
||||
}
|
||||
this._serverProcess = process;
|
||||
process.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
process.stdout.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
return transport.onConnected().then((protocol) => {
|
||||
return { reader: protocol[0], writer: protocol[1] };
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
let pipeName = undefined;
|
||||
return new Promise((resolve, reject) => {
|
||||
let args = node.args && node.args.slice() || [];
|
||||
if (transport === TransportKind.ipc) {
|
||||
args.push('--node-ipc');
|
||||
}
|
||||
else if (transport === TransportKind.stdio) {
|
||||
args.push('--stdio');
|
||||
}
|
||||
else if (transport === TransportKind.pipe) {
|
||||
pipeName = vscode_languageserver_protocol_1.generateRandomPipeName();
|
||||
args.push(`--pipe=${pipeName}`);
|
||||
}
|
||||
else if (Transport.isSocket(transport)) {
|
||||
args.push(`--socket=${transport.port}`);
|
||||
}
|
||||
args.push(`--clientProcessId=${process.pid.toString()}`);
|
||||
let options = node.options || Object.create(null);
|
||||
options.execArgv = options.execArgv || [];
|
||||
options.cwd = serverWorkingDir;
|
||||
if (transport === TransportKind.ipc || transport === TransportKind.stdio) {
|
||||
electron.fork(node.module, args || [], options, (error, serverProcess) => {
|
||||
if (error || !serverProcess) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
this._serverProcess = serverProcess;
|
||||
serverProcess.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
if (transport === TransportKind.ipc) {
|
||||
serverProcess.stdout.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
resolve({ reader: new vscode_languageserver_protocol_1.IPCMessageReader(this._serverProcess), writer: new vscode_languageserver_protocol_1.IPCMessageWriter(this._serverProcess) });
|
||||
}
|
||||
else {
|
||||
resolve({ reader: new vscode_languageserver_protocol_1.StreamMessageReader(serverProcess.stdout), writer: new vscode_languageserver_protocol_1.StreamMessageWriter(serverProcess.stdin) });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (transport === TransportKind.pipe) {
|
||||
vscode_languageserver_protocol_1.createClientPipeTransport(pipeName).then((transport) => {
|
||||
electron.fork(node.module, args || [], options, (error, cp) => {
|
||||
if (error || !cp) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
this._serverProcess = cp;
|
||||
cp.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
cp.stdout.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
transport.onConnected().then((protocol) => {
|
||||
resolve({ reader: protocol[0], writer: protocol[1] });
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else if (Transport.isSocket(transport)) {
|
||||
vscode_languageserver_protocol_1.createClientSocketTransport(transport.port).then((transport) => {
|
||||
electron.fork(node.module, args || [], options, (error, cp) => {
|
||||
if (error || !cp) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
this._serverProcess = cp;
|
||||
cp.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
cp.stdout.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
transport.onConnected().then((protocol) => {
|
||||
resolve({ reader: protocol[0], writer: protocol[1] });
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (Executable.is(json) && json.command) {
|
||||
let command = json;
|
||||
let args = command.args || [];
|
||||
let options = Object.assign({}, command.options);
|
||||
options.cwd = options.cwd || serverWorkingDir;
|
||||
let serverProcess = cp.spawn(command.command, args, options);
|
||||
if (!serverProcess || !serverProcess.pid) {
|
||||
return Promise.reject(`Launching server using command ${command.command} failed.`);
|
||||
}
|
||||
serverProcess.stderr.on('data', data => this.outputChannel.append(Is.string(data) ? data : data.toString(encoding)));
|
||||
this._serverProcess = serverProcess;
|
||||
this._isDetached = !!options.detached;
|
||||
return Promise.resolve({ reader: new vscode_languageserver_protocol_1.StreamMessageReader(serverProcess.stdout), writer: new vscode_languageserver_protocol_1.StreamMessageWriter(serverProcess.stdin) });
|
||||
}
|
||||
return Promise.reject(new Error(`Unsupported server configuration ` + JSON.stringify(server, null, 4)));
|
||||
});
|
||||
}
|
||||
registerProposedFeatures() {
|
||||
this.registerFeatures(ProposedFeatures.createAll(this));
|
||||
}
|
||||
registerBuiltinFeatures() {
|
||||
super.registerBuiltinFeatures();
|
||||
this.registerFeature(new configuration_1.ConfigurationFeature(this));
|
||||
this.registerFeature(new typeDefinition_1.TypeDefinitionFeature(this));
|
||||
this.registerFeature(new implementation_1.ImplementationFeature(this));
|
||||
this.registerFeature(new colorProvider_1.ColorProviderFeature(this));
|
||||
this.registerFeature(new workspaceFolders_1.WorkspaceFoldersFeature(this));
|
||||
this.registerFeature(new foldingRange_1.FoldingRangeFeature(this));
|
||||
}
|
||||
_mainGetRootPath() {
|
||||
let folders = vscode_1.workspace.workspaceFolders;
|
||||
if (!folders || folders.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
let folder = folders[0];
|
||||
if (folder.uri.scheme === 'file') {
|
||||
return folder.uri.fsPath;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
_getServerWorkingDir(options) {
|
||||
let cwd = options && options.cwd;
|
||||
if (!cwd) {
|
||||
cwd = this.clientOptions.workspaceFolder
|
||||
? this.clientOptions.workspaceFolder.uri.fsPath
|
||||
: this._mainGetRootPath();
|
||||
}
|
||||
if (cwd) {
|
||||
// make sure the folder exists otherwise creating the process will fail
|
||||
return new Promise(s => {
|
||||
fs.lstat(cwd, (err, stats) => {
|
||||
s(!err && stats.isDirectory() ? cwd : undefined);
|
||||
});
|
||||
});
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
exports.LanguageClient = LanguageClient;
|
||||
class SettingMonitor {
|
||||
constructor(_client, _setting) {
|
||||
this._client = _client;
|
||||
this._setting = _setting;
|
||||
this._listeners = [];
|
||||
}
|
||||
start() {
|
||||
vscode_1.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, this._listeners);
|
||||
this.onDidChangeConfiguration();
|
||||
return new vscode_1.Disposable(() => {
|
||||
if (this._client.needsStop()) {
|
||||
this._client.stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
onDidChangeConfiguration() {
|
||||
let index = this._setting.indexOf('.');
|
||||
let primary = index >= 0 ? this._setting.substr(0, index) : this._setting;
|
||||
let rest = index >= 0 ? this._setting.substr(index + 1) : undefined;
|
||||
let enabled = rest ? vscode_1.workspace.getConfiguration(primary).get(rest, false) : vscode_1.workspace.getConfiguration(primary);
|
||||
if (enabled && this._client.needsStart()) {
|
||||
this._client.start();
|
||||
}
|
||||
else if (!enabled && this._client.needsStop()) {
|
||||
this._client.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.SettingMonitor = SettingMonitor;
|
||||
// Exporting proposed protocol.
|
||||
var ProposedFeatures;
|
||||
(function (ProposedFeatures) {
|
||||
function createAll(_client) {
|
||||
let result = [];
|
||||
return result;
|
||||
}
|
||||
ProposedFeatures.createAll = createAll;
|
||||
})(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {}));
|
||||
5
Client/node_modules/vscode-languageclient/lib/protocolCodeLens.d.ts
generated
vendored
Executable file
5
Client/node_modules/vscode-languageclient/lib/protocolCodeLens.d.ts
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
import * as code from 'vscode';
|
||||
export default class ProtocolCodeLens extends code.CodeLens {
|
||||
data: any;
|
||||
constructor(range: code.Range);
|
||||
}
|
||||
13
Client/node_modules/vscode-languageclient/lib/protocolCodeLens.js
generated
vendored
Executable file
13
Client/node_modules/vscode-languageclient/lib/protocolCodeLens.js
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const code = require("vscode");
|
||||
class ProtocolCodeLens extends code.CodeLens {
|
||||
constructor(range) {
|
||||
super(range);
|
||||
}
|
||||
}
|
||||
exports.default = ProtocolCodeLens;
|
||||
10
Client/node_modules/vscode-languageclient/lib/protocolCompletionItem.d.ts
generated
vendored
Executable file
10
Client/node_modules/vscode-languageclient/lib/protocolCompletionItem.d.ts
generated
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
import * as code from 'vscode';
|
||||
import * as proto from 'vscode-languageserver-protocol';
|
||||
export default class ProtocolCompletionItem extends code.CompletionItem {
|
||||
data: any;
|
||||
fromEdit: boolean;
|
||||
documentationFormat: string;
|
||||
originalItemKind: proto.CompletionItemKind;
|
||||
deprecated: boolean;
|
||||
constructor(label: string);
|
||||
}
|
||||
13
Client/node_modules/vscode-languageclient/lib/protocolCompletionItem.js
generated
vendored
Executable file
13
Client/node_modules/vscode-languageclient/lib/protocolCompletionItem.js
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const code = require("vscode");
|
||||
class ProtocolCompletionItem extends code.CompletionItem {
|
||||
constructor(label) {
|
||||
super(label);
|
||||
}
|
||||
}
|
||||
exports.default = ProtocolCompletionItem;
|
||||
97
Client/node_modules/vscode-languageclient/lib/protocolConverter.d.ts
generated
vendored
Executable file
97
Client/node_modules/vscode-languageclient/lib/protocolConverter.d.ts
generated
vendored
Executable file
@@ -0,0 +1,97 @@
|
||||
import * as code from 'vscode';
|
||||
import * as ls from 'vscode-languageserver-protocol';
|
||||
import ProtocolCompletionItem from './protocolCompletionItem';
|
||||
export interface Converter {
|
||||
asUri(value: string): code.Uri;
|
||||
asDiagnostic(diagnostic: ls.Diagnostic): code.Diagnostic;
|
||||
asDiagnostics(diagnostics: ls.Diagnostic[]): code.Diagnostic[];
|
||||
asPosition(value: undefined | null): undefined;
|
||||
asPosition(value: ls.Position): code.Position;
|
||||
asPosition(value: ls.Position | undefined | null): code.Position | undefined;
|
||||
asRange(value: undefined | null): undefined;
|
||||
asRange(value: ls.Range): code.Range;
|
||||
asRange(value: ls.Range | undefined | null): code.Range | undefined;
|
||||
asDiagnosticSeverity(value: number | undefined | null): code.DiagnosticSeverity;
|
||||
asHover(hover: ls.Hover): code.Hover;
|
||||
asHover(hover: undefined | null): undefined;
|
||||
asHover(hover: ls.Hover | undefined | null): code.Hover | undefined;
|
||||
asCompletionResult(result: ls.CompletionList): code.CompletionList;
|
||||
asCompletionResult(result: ls.CompletionItem[]): code.CompletionItem[];
|
||||
asCompletionResult(result: undefined | null): undefined;
|
||||
asCompletionResult(result: ls.CompletionItem[] | ls.CompletionList | undefined | null): code.CompletionItem[] | code.CompletionList | undefined;
|
||||
asCompletionItem(item: ls.CompletionItem): ProtocolCompletionItem;
|
||||
asTextEdit(edit: undefined | null): undefined;
|
||||
asTextEdit(edit: ls.TextEdit): code.TextEdit;
|
||||
asTextEdit(edit: ls.TextEdit | undefined | null): code.TextEdit | undefined;
|
||||
asTextEdits(items: ls.TextEdit[]): code.TextEdit[];
|
||||
asTextEdits(items: undefined | null): undefined;
|
||||
asTextEdits(items: ls.TextEdit[] | undefined | null): code.TextEdit[] | undefined;
|
||||
asSignatureHelp(item: undefined | null): undefined;
|
||||
asSignatureHelp(item: ls.SignatureHelp): code.SignatureHelp;
|
||||
asSignatureHelp(item: ls.SignatureHelp | undefined | null): code.SignatureHelp | undefined;
|
||||
asSignatureInformation(item: ls.SignatureInformation): code.SignatureInformation;
|
||||
asSignatureInformations(items: ls.SignatureInformation[]): code.SignatureInformation[];
|
||||
asParameterInformation(item: ls.ParameterInformation): code.ParameterInformation;
|
||||
asParameterInformations(item: ls.ParameterInformation[]): code.ParameterInformation[];
|
||||
asDefinitionResult(item: ls.Definition): code.Definition;
|
||||
asDefinitionResult(item: undefined | null): undefined;
|
||||
asDefinitionResult(item: ls.Definition | undefined | null): code.Definition | undefined;
|
||||
asLocation(item: ls.Location): code.Location;
|
||||
asLocation(item: undefined | null): undefined;
|
||||
asLocation(item: ls.Location | undefined | null): code.Location | undefined;
|
||||
asReferences(values: ls.Location[]): code.Location[];
|
||||
asReferences(values: undefined | null): code.Location[] | undefined;
|
||||
asReferences(values: ls.Location[] | undefined | null): code.Location[] | undefined;
|
||||
asDocumentHighlightKind(item: number): code.DocumentHighlightKind;
|
||||
asDocumentHighlight(item: ls.DocumentHighlight): code.DocumentHighlight;
|
||||
asDocumentHighlights(values: ls.DocumentHighlight[]): code.DocumentHighlight[];
|
||||
asDocumentHighlights(values: undefined | null): undefined;
|
||||
asDocumentHighlights(values: ls.DocumentHighlight[] | undefined | null): code.DocumentHighlight[] | undefined;
|
||||
asSymbolInformation(item: ls.SymbolInformation, uri?: code.Uri): code.SymbolInformation;
|
||||
asSymbolInformations(values: ls.SymbolInformation[], uri?: code.Uri): code.SymbolInformation[];
|
||||
asSymbolInformations(values: undefined | null, uri?: code.Uri): undefined;
|
||||
asSymbolInformations(values: ls.SymbolInformation[] | undefined | null, uri?: code.Uri): code.SymbolInformation[] | undefined;
|
||||
asDocumentSymbol(value: ls.DocumentSymbol): code.DocumentSymbol;
|
||||
asDocumentSymbols(value: undefined | null): undefined;
|
||||
asDocumentSymbols(value: ls.DocumentSymbol[]): code.DocumentSymbol[];
|
||||
asDocumentSymbols(value: ls.DocumentSymbol[] | undefined | null): code.DocumentSymbol[] | undefined;
|
||||
asCommand(item: ls.Command): code.Command;
|
||||
asCommands(items: ls.Command[]): code.Command[];
|
||||
asCommands(items: undefined | null): undefined;
|
||||
asCommands(items: ls.Command[] | undefined | null): code.Command[] | undefined;
|
||||
asCodeAction(item: ls.CodeAction): code.CodeAction;
|
||||
asCodeAction(item: undefined | null): undefined;
|
||||
asCodeAction(item: ls.CodeAction | undefined | null): code.CodeAction | undefined;
|
||||
asCodeLens(item: ls.CodeLens): code.CodeLens;
|
||||
asCodeLens(item: undefined | null): undefined;
|
||||
asCodeLens(item: ls.CodeLens | undefined | null): code.CodeLens | undefined;
|
||||
asCodeLenses(items: ls.CodeLens[]): code.CodeLens[];
|
||||
asCodeLenses(items: undefined | null): undefined;
|
||||
asCodeLenses(items: ls.CodeLens[] | undefined | null): code.CodeLens[] | undefined;
|
||||
asWorkspaceEdit(item: ls.WorkspaceEdit): code.WorkspaceEdit;
|
||||
asWorkspaceEdit(item: undefined | null): undefined;
|
||||
asWorkspaceEdit(item: ls.WorkspaceEdit | undefined | null): code.WorkspaceEdit | undefined;
|
||||
asDocumentLink(item: ls.DocumentLink): code.DocumentLink;
|
||||
asDocumentLinks(items: ls.DocumentLink[]): code.DocumentLink[];
|
||||
asDocumentLinks(items: undefined | null): undefined;
|
||||
asDocumentLinks(items: ls.DocumentLink[] | undefined | null): code.DocumentLink[] | undefined;
|
||||
asColor(color: ls.Color): code.Color;
|
||||
asColorInformation(ci: ls.ColorInformation): code.ColorInformation;
|
||||
asColorInformations(colorPresentations: ls.ColorInformation[]): code.ColorInformation[];
|
||||
asColorInformations(colorPresentations: undefined | null): undefined;
|
||||
asColorInformations(colorInformation: ls.ColorInformation[] | undefined | null): code.ColorInformation[];
|
||||
asColorPresentation(cp: ls.ColorPresentation): code.ColorPresentation;
|
||||
asColorPresentations(colorPresentations: ls.ColorPresentation[]): code.ColorPresentation[];
|
||||
asColorPresentations(colorPresentations: undefined | null): undefined;
|
||||
asColorPresentations(colorPresentations: ls.ColorPresentation[] | undefined | null): undefined;
|
||||
asFoldingRangeKind(kind: string | undefined): code.FoldingRangeKind | undefined;
|
||||
asFoldingRange(r: ls.FoldingRange): code.FoldingRange;
|
||||
asFoldingRanges(foldingRanges: ls.FoldingRange[]): code.FoldingRange[];
|
||||
asFoldingRanges(foldingRanges: undefined | null): undefined;
|
||||
asFoldingRanges(foldingRanges: ls.FoldingRange[] | undefined | null): code.FoldingRange[] | undefined;
|
||||
asFoldingRanges(foldingRanges: ls.FoldingRange[] | undefined | null): code.FoldingRange[] | undefined;
|
||||
}
|
||||
export interface URIConverter {
|
||||
(value: string): code.Uri;
|
||||
}
|
||||
export declare function createConverter(uriConverter?: URIConverter): Converter;
|
||||
571
Client/node_modules/vscode-languageclient/lib/protocolConverter.js
generated
vendored
Executable file
571
Client/node_modules/vscode-languageclient/lib/protocolConverter.js
generated
vendored
Executable file
@@ -0,0 +1,571 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const code = require("vscode");
|
||||
const ls = require("vscode-languageserver-protocol");
|
||||
const Is = require("./utils/is");
|
||||
const protocolCompletionItem_1 = require("./protocolCompletionItem");
|
||||
const protocolCodeLens_1 = require("./protocolCodeLens");
|
||||
const protocolDocumentLink_1 = require("./protocolDocumentLink");
|
||||
var CodeBlock;
|
||||
(function (CodeBlock) {
|
||||
function is(value) {
|
||||
let candidate = value;
|
||||
return candidate && Is.string(candidate.language) && Is.string(candidate.value);
|
||||
}
|
||||
CodeBlock.is = is;
|
||||
})(CodeBlock || (CodeBlock = {}));
|
||||
function createConverter(uriConverter) {
|
||||
const nullConverter = (value) => code.Uri.parse(value);
|
||||
const _uriConverter = uriConverter || nullConverter;
|
||||
function asUri(value) {
|
||||
return _uriConverter(value);
|
||||
}
|
||||
function asDiagnostics(diagnostics) {
|
||||
return diagnostics.map(asDiagnostic);
|
||||
}
|
||||
function asDiagnostic(diagnostic) {
|
||||
let result = new code.Diagnostic(asRange(diagnostic.range), diagnostic.message, asDiagnosticSeverity(diagnostic.severity));
|
||||
if (Is.number(diagnostic.code) || Is.string(diagnostic.code)) {
|
||||
result.code = diagnostic.code;
|
||||
}
|
||||
if (diagnostic.source) {
|
||||
result.source = diagnostic.source;
|
||||
}
|
||||
if (diagnostic.relatedInformation) {
|
||||
result.relatedInformation = asRelatedInformation(diagnostic.relatedInformation);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asRelatedInformation(relatedInformation) {
|
||||
return relatedInformation.map(asDiagnosticRelatedInformation);
|
||||
}
|
||||
function asDiagnosticRelatedInformation(information) {
|
||||
return new code.DiagnosticRelatedInformation(asLocation(information.location), information.message);
|
||||
}
|
||||
function asPosition(value) {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
return new code.Position(value.line, value.character);
|
||||
}
|
||||
function asRange(value) {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
return new code.Range(asPosition(value.start), asPosition(value.end));
|
||||
}
|
||||
function asDiagnosticSeverity(value) {
|
||||
if (value === void 0 || value === null) {
|
||||
return code.DiagnosticSeverity.Error;
|
||||
}
|
||||
switch (value) {
|
||||
case ls.DiagnosticSeverity.Error:
|
||||
return code.DiagnosticSeverity.Error;
|
||||
case ls.DiagnosticSeverity.Warning:
|
||||
return code.DiagnosticSeverity.Warning;
|
||||
case ls.DiagnosticSeverity.Information:
|
||||
return code.DiagnosticSeverity.Information;
|
||||
case ls.DiagnosticSeverity.Hint:
|
||||
return code.DiagnosticSeverity.Hint;
|
||||
}
|
||||
return code.DiagnosticSeverity.Error;
|
||||
}
|
||||
function asHoverContent(value) {
|
||||
if (Is.string(value)) {
|
||||
return new code.MarkdownString(value);
|
||||
}
|
||||
else if (CodeBlock.is(value)) {
|
||||
let result = new code.MarkdownString();
|
||||
return result.appendCodeblock(value.value, value.language);
|
||||
}
|
||||
else if (Array.isArray(value)) {
|
||||
let result = [];
|
||||
for (let element of value) {
|
||||
let item = new code.MarkdownString();
|
||||
if (CodeBlock.is(element)) {
|
||||
item.appendCodeblock(element.value, element.language);
|
||||
}
|
||||
else {
|
||||
item.appendMarkdown(element);
|
||||
}
|
||||
result.push(item);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
let result;
|
||||
switch (value.kind) {
|
||||
case ls.MarkupKind.Markdown:
|
||||
return new code.MarkdownString(value.value);
|
||||
case ls.MarkupKind.PlainText:
|
||||
result = new code.MarkdownString();
|
||||
result.appendText(value.value);
|
||||
return result;
|
||||
default:
|
||||
result = new code.MarkdownString();
|
||||
result.appendText(`Unsupported Markup content received. Kind is: ${value.kind}`);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
function asDocumentation(value) {
|
||||
if (Is.string(value)) {
|
||||
return value;
|
||||
}
|
||||
else {
|
||||
switch (value.kind) {
|
||||
case ls.MarkupKind.Markdown:
|
||||
return new code.MarkdownString(value.value);
|
||||
case ls.MarkupKind.PlainText:
|
||||
return value.value;
|
||||
default:
|
||||
return `Unsupported Markup content received. Kind is: ${value.kind}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
function asHover(hover) {
|
||||
if (!hover) {
|
||||
return undefined;
|
||||
}
|
||||
return new code.Hover(asHoverContent(hover.contents), asRange(hover.range));
|
||||
}
|
||||
function asCompletionResult(result) {
|
||||
if (!result) {
|
||||
return undefined;
|
||||
}
|
||||
if (Array.isArray(result)) {
|
||||
let items = result;
|
||||
return items.map(asCompletionItem);
|
||||
}
|
||||
let list = result;
|
||||
return new code.CompletionList(list.items.map(asCompletionItem), list.isIncomplete);
|
||||
}
|
||||
function asCompletionItemKind(value) {
|
||||
// Protocol item kind is 1 based, codes item kind is zero based.
|
||||
if (ls.CompletionItemKind.Text <= value && value <= ls.CompletionItemKind.TypeParameter) {
|
||||
return [value - 1, undefined];
|
||||
}
|
||||
;
|
||||
return [code.CompletionItemKind.Text, value];
|
||||
}
|
||||
function asCompletionItem(item) {
|
||||
let result = new protocolCompletionItem_1.default(item.label);
|
||||
if (item.detail) {
|
||||
result.detail = item.detail;
|
||||
}
|
||||
if (item.documentation) {
|
||||
result.documentation = asDocumentation(item.documentation);
|
||||
result.documentationFormat = Is.string(item.documentation) ? '$string' : item.documentation.kind;
|
||||
}
|
||||
;
|
||||
if (item.filterText) {
|
||||
result.filterText = item.filterText;
|
||||
}
|
||||
let insertText = asCompletionInsertText(item);
|
||||
if (insertText) {
|
||||
result.insertText = insertText.text;
|
||||
result.range = insertText.range;
|
||||
result.fromEdit = insertText.fromEdit;
|
||||
}
|
||||
if (Is.number(item.kind)) {
|
||||
let [itemKind, original] = asCompletionItemKind(item.kind);
|
||||
result.kind = itemKind;
|
||||
if (original) {
|
||||
result.originalItemKind = original;
|
||||
}
|
||||
}
|
||||
if (item.sortText) {
|
||||
result.sortText = item.sortText;
|
||||
}
|
||||
if (item.additionalTextEdits) {
|
||||
result.additionalTextEdits = asTextEdits(item.additionalTextEdits);
|
||||
}
|
||||
if (Is.stringArray(item.commitCharacters)) {
|
||||
result.commitCharacters = item.commitCharacters.slice();
|
||||
}
|
||||
if (item.command) {
|
||||
result.command = asCommand(item.command);
|
||||
}
|
||||
if (item.deprecated === true || item.deprecated === false) {
|
||||
result.deprecated = item.deprecated;
|
||||
}
|
||||
if (item.preselect === true || item.preselect === false) {
|
||||
result.preselect = item.preselect;
|
||||
}
|
||||
if (item.data !== void 0) {
|
||||
result.data = item.data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asCompletionInsertText(item) {
|
||||
if (item.textEdit) {
|
||||
if (item.insertTextFormat === ls.InsertTextFormat.Snippet) {
|
||||
return { text: new code.SnippetString(item.textEdit.newText), range: asRange(item.textEdit.range), fromEdit: true };
|
||||
}
|
||||
else {
|
||||
return { text: item.textEdit.newText, range: asRange(item.textEdit.range), fromEdit: true };
|
||||
}
|
||||
}
|
||||
else if (item.insertText) {
|
||||
if (item.insertTextFormat === ls.InsertTextFormat.Snippet) {
|
||||
return { text: new code.SnippetString(item.insertText), fromEdit: false };
|
||||
}
|
||||
else {
|
||||
return { text: item.insertText, fromEdit: false };
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function asTextEdit(edit) {
|
||||
if (!edit) {
|
||||
return undefined;
|
||||
}
|
||||
return new code.TextEdit(asRange(edit.range), edit.newText);
|
||||
}
|
||||
function asTextEdits(items) {
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
return items.map(asTextEdit);
|
||||
}
|
||||
function asSignatureHelp(item) {
|
||||
if (!item) {
|
||||
return undefined;
|
||||
}
|
||||
let result = new code.SignatureHelp();
|
||||
if (Is.number(item.activeSignature)) {
|
||||
result.activeSignature = item.activeSignature;
|
||||
}
|
||||
else {
|
||||
// activeSignature was optional in the past
|
||||
result.activeSignature = 0;
|
||||
}
|
||||
if (Is.number(item.activeParameter)) {
|
||||
result.activeParameter = item.activeParameter;
|
||||
}
|
||||
else {
|
||||
// activeParameter was optional in the past
|
||||
result.activeParameter = 0;
|
||||
}
|
||||
if (item.signatures) {
|
||||
result.signatures = asSignatureInformations(item.signatures);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asSignatureInformations(items) {
|
||||
return items.map(asSignatureInformation);
|
||||
}
|
||||
function asSignatureInformation(item) {
|
||||
let result = new code.SignatureInformation(item.label);
|
||||
if (item.documentation) {
|
||||
result.documentation = asDocumentation(item.documentation);
|
||||
}
|
||||
if (item.parameters) {
|
||||
result.parameters = asParameterInformations(item.parameters);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asParameterInformations(item) {
|
||||
return item.map(asParameterInformation);
|
||||
}
|
||||
function asParameterInformation(item) {
|
||||
let result = new code.ParameterInformation(item.label);
|
||||
if (item.documentation) {
|
||||
result.documentation = asDocumentation(item.documentation);
|
||||
}
|
||||
;
|
||||
return result;
|
||||
}
|
||||
function asDefinitionResult(item) {
|
||||
if (!item) {
|
||||
return undefined;
|
||||
}
|
||||
if (Is.array(item)) {
|
||||
return item.map((location) => asLocation(location));
|
||||
}
|
||||
else {
|
||||
return asLocation(item);
|
||||
}
|
||||
}
|
||||
function asLocation(item) {
|
||||
if (!item) {
|
||||
return undefined;
|
||||
}
|
||||
return new code.Location(_uriConverter(item.uri), asRange(item.range));
|
||||
}
|
||||
function asReferences(values) {
|
||||
if (!values) {
|
||||
return undefined;
|
||||
}
|
||||
return values.map(location => asLocation(location));
|
||||
}
|
||||
function asDocumentHighlights(values) {
|
||||
if (!values) {
|
||||
return undefined;
|
||||
}
|
||||
return values.map(asDocumentHighlight);
|
||||
}
|
||||
function asDocumentHighlight(item) {
|
||||
let result = new code.DocumentHighlight(asRange(item.range));
|
||||
if (Is.number(item.kind)) {
|
||||
result.kind = asDocumentHighlightKind(item.kind);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asDocumentHighlightKind(item) {
|
||||
switch (item) {
|
||||
case ls.DocumentHighlightKind.Text:
|
||||
return code.DocumentHighlightKind.Text;
|
||||
case ls.DocumentHighlightKind.Read:
|
||||
return code.DocumentHighlightKind.Read;
|
||||
case ls.DocumentHighlightKind.Write:
|
||||
return code.DocumentHighlightKind.Write;
|
||||
}
|
||||
return code.DocumentHighlightKind.Text;
|
||||
}
|
||||
function asSymbolInformations(values, uri) {
|
||||
if (!values) {
|
||||
return undefined;
|
||||
}
|
||||
return values.map(information => asSymbolInformation(information, uri));
|
||||
}
|
||||
function asSymbolKind(item) {
|
||||
if (item <= ls.SymbolKind.TypeParameter) {
|
||||
// Symbol kind is one based in the protocol and zero based in code.
|
||||
return item - 1;
|
||||
}
|
||||
return code.SymbolKind.Property;
|
||||
}
|
||||
function asSymbolInformation(item, uri) {
|
||||
// Symbol kind is one based in the protocol and zero based in code.
|
||||
let result = new code.SymbolInformation(item.name, asSymbolKind(item.kind), asRange(item.location.range), item.location.uri ? _uriConverter(item.location.uri) : uri);
|
||||
if (item.containerName) {
|
||||
result.containerName = item.containerName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asDocumentSymbols(values) {
|
||||
if (values === void 0 || values === null) {
|
||||
return undefined;
|
||||
}
|
||||
return values.map(asDocumentSymbol);
|
||||
}
|
||||
function asDocumentSymbol(value) {
|
||||
let result = new code.DocumentSymbol(value.name, value.detail || '', asSymbolKind(value.kind), asRange(value.range), asRange(value.selectionRange));
|
||||
if (value.children !== void 0 && value.children.length > 0) {
|
||||
let children = [];
|
||||
for (let child of value.children) {
|
||||
children.push(asDocumentSymbol(child));
|
||||
}
|
||||
result.children = children;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asCommand(item) {
|
||||
let result = { title: item.title, command: item.command };
|
||||
if (item.arguments) {
|
||||
result.arguments = item.arguments;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asCommands(items) {
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
return items.map(asCommand);
|
||||
}
|
||||
const kindMapping = new Map();
|
||||
kindMapping.set('', code.CodeActionKind.Empty);
|
||||
kindMapping.set(ls.CodeActionKind.QuickFix, code.CodeActionKind.QuickFix);
|
||||
kindMapping.set(ls.CodeActionKind.Refactor, code.CodeActionKind.Refactor);
|
||||
kindMapping.set(ls.CodeActionKind.RefactorExtract, code.CodeActionKind.RefactorExtract);
|
||||
kindMapping.set(ls.CodeActionKind.RefactorInline, code.CodeActionKind.RefactorInline);
|
||||
kindMapping.set(ls.CodeActionKind.RefactorRewrite, code.CodeActionKind.RefactorRewrite);
|
||||
kindMapping.set(ls.CodeActionKind.Source, code.CodeActionKind.Source);
|
||||
kindMapping.set(ls.CodeActionKind.SourceOrganizeImports, code.CodeActionKind.SourceOrganizeImports);
|
||||
function asCodeActionKind(item) {
|
||||
if (item === void 0 || item === null) {
|
||||
return undefined;
|
||||
}
|
||||
let result = kindMapping.get(item);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
let parts = item.split('.');
|
||||
result = code.CodeActionKind.Empty;
|
||||
for (let part of parts) {
|
||||
result = result.append(part);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asCodeAction(item) {
|
||||
if (item === void 0 || item === null) {
|
||||
return undefined;
|
||||
}
|
||||
let result = new code.CodeAction(item.title);
|
||||
if (item.kind !== void 0) {
|
||||
result.kind = asCodeActionKind(item.kind);
|
||||
}
|
||||
if (item.diagnostics) {
|
||||
result.diagnostics = asDiagnostics(item.diagnostics);
|
||||
}
|
||||
if (item.edit) {
|
||||
result.edit = asWorkspaceEdit(item.edit);
|
||||
}
|
||||
if (item.command) {
|
||||
result.command = asCommand(item.command);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asCodeLens(item) {
|
||||
if (!item) {
|
||||
return undefined;
|
||||
}
|
||||
let result = new protocolCodeLens_1.default(asRange(item.range));
|
||||
if (item.command) {
|
||||
result.command = asCommand(item.command);
|
||||
}
|
||||
if (item.data !== void 0 && item.data !== null) {
|
||||
result.data = item.data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asCodeLenses(items) {
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
return items.map((codeLens) => asCodeLens(codeLens));
|
||||
}
|
||||
function asWorkspaceEdit(item) {
|
||||
if (!item) {
|
||||
return undefined;
|
||||
}
|
||||
let result = new code.WorkspaceEdit();
|
||||
if (item.documentChanges) {
|
||||
item.documentChanges.forEach(change => {
|
||||
result.set(_uriConverter(change.textDocument.uri), asTextEdits(change.edits));
|
||||
});
|
||||
}
|
||||
else if (item.changes) {
|
||||
Object.keys(item.changes).forEach(key => {
|
||||
result.set(_uriConverter(key), asTextEdits(item.changes[key]));
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function asDocumentLink(item) {
|
||||
let range = asRange(item.range);
|
||||
let target = item.target ? asUri(item.target) : undefined;
|
||||
// target must be optional in DocumentLink
|
||||
let link = new protocolDocumentLink_1.default(range, target);
|
||||
if (item.data !== void 0 && item.data !== null) {
|
||||
link.data = item.data;
|
||||
}
|
||||
return link;
|
||||
}
|
||||
function asDocumentLinks(items) {
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
return items.map(asDocumentLink);
|
||||
}
|
||||
function asColor(color) {
|
||||
return new code.Color(color.red, color.green, color.blue, color.alpha);
|
||||
}
|
||||
function asColorInformation(ci) {
|
||||
return new code.ColorInformation(asRange(ci.range), asColor(ci.color));
|
||||
}
|
||||
function asColorInformations(colorInformation) {
|
||||
if (Array.isArray(colorInformation)) {
|
||||
return colorInformation.map(asColorInformation);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function asColorPresentation(cp) {
|
||||
let presentation = new code.ColorPresentation(cp.label);
|
||||
presentation.additionalTextEdits = asTextEdits(cp.additionalTextEdits);
|
||||
if (cp.textEdit) {
|
||||
presentation.textEdit = asTextEdit(cp.textEdit);
|
||||
}
|
||||
return presentation;
|
||||
}
|
||||
function asColorPresentations(colorPresentations) {
|
||||
if (Array.isArray(colorPresentations)) {
|
||||
return colorPresentations.map(asColorPresentation);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function asFoldingRangeKind(kind) {
|
||||
if (kind) {
|
||||
switch (kind) {
|
||||
case ls.FoldingRangeKind.Comment:
|
||||
return code.FoldingRangeKind.Comment;
|
||||
case ls.FoldingRangeKind.Imports:
|
||||
return code.FoldingRangeKind.Imports;
|
||||
case ls.FoldingRangeKind.Region:
|
||||
return code.FoldingRangeKind.Region;
|
||||
}
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
function asFoldingRange(r) {
|
||||
return new code.FoldingRange(r.startLine, r.endLine, asFoldingRangeKind(r.kind));
|
||||
}
|
||||
function asFoldingRanges(foldingRanges) {
|
||||
if (Array.isArray(foldingRanges)) {
|
||||
return foldingRanges.map(asFoldingRange);
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
return {
|
||||
asUri,
|
||||
asDiagnostics,
|
||||
asDiagnostic,
|
||||
asRange,
|
||||
asPosition,
|
||||
asDiagnosticSeverity,
|
||||
asHover,
|
||||
asCompletionResult,
|
||||
asCompletionItem,
|
||||
asTextEdit,
|
||||
asTextEdits,
|
||||
asSignatureHelp,
|
||||
asSignatureInformations,
|
||||
asSignatureInformation,
|
||||
asParameterInformations,
|
||||
asParameterInformation,
|
||||
asDefinitionResult,
|
||||
asLocation,
|
||||
asReferences,
|
||||
asDocumentHighlights,
|
||||
asDocumentHighlight,
|
||||
asDocumentHighlightKind,
|
||||
asSymbolInformations,
|
||||
asSymbolInformation,
|
||||
asDocumentSymbols,
|
||||
asDocumentSymbol,
|
||||
asCommand,
|
||||
asCommands,
|
||||
asCodeAction,
|
||||
asCodeLens,
|
||||
asCodeLenses,
|
||||
asWorkspaceEdit,
|
||||
asDocumentLink,
|
||||
asDocumentLinks,
|
||||
asFoldingRangeKind,
|
||||
asFoldingRange,
|
||||
asFoldingRanges,
|
||||
asColor,
|
||||
asColorInformation,
|
||||
asColorInformations,
|
||||
asColorPresentation,
|
||||
asColorPresentations
|
||||
};
|
||||
}
|
||||
exports.createConverter = createConverter;
|
||||
5
Client/node_modules/vscode-languageclient/lib/protocolDocumentLink.d.ts
generated
vendored
Executable file
5
Client/node_modules/vscode-languageclient/lib/protocolDocumentLink.d.ts
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
import * as code from 'vscode';
|
||||
export default class ProtocolDocumentLink extends code.DocumentLink {
|
||||
data: any;
|
||||
constructor(range: code.Range, target?: code.Uri | undefined);
|
||||
}
|
||||
13
Client/node_modules/vscode-languageclient/lib/protocolDocumentLink.js
generated
vendored
Executable file
13
Client/node_modules/vscode-languageclient/lib/protocolDocumentLink.js
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const code = require("vscode");
|
||||
class ProtocolDocumentLink extends code.DocumentLink {
|
||||
constructor(range, target) {
|
||||
super(range, target);
|
||||
}
|
||||
}
|
||||
exports.default = ProtocolDocumentLink;
|
||||
15
Client/node_modules/vscode-languageclient/lib/typeDefinition.d.ts
generated
vendored
Executable file
15
Client/node_modules/vscode-languageclient/lib/typeDefinition.d.ts
generated
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Definition as VDefinition } from 'vscode';
|
||||
import { ClientCapabilities, CancellationToken, ServerCapabilities, TextDocumentRegistrationOptions, DocumentSelector } from 'vscode-languageserver-protocol';
|
||||
import { TextDocumentFeature, BaseLanguageClient } from './client';
|
||||
export interface ProvideTypeDefinitionSignature {
|
||||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition>;
|
||||
}
|
||||
export interface TypeDefinitionMiddleware {
|
||||
provideTypeDefinition?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideTypeDefinitionSignature) => ProviderResult<VDefinition>;
|
||||
}
|
||||
export declare class TypeDefinitionFeature extends TextDocumentFeature<TextDocumentRegistrationOptions> {
|
||||
constructor(client: BaseLanguageClient);
|
||||
fillClientCapabilities(capabilites: ClientCapabilities): void;
|
||||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
||||
protected registerLanguageProvider(options: TextDocumentRegistrationOptions): Disposable;
|
||||
}
|
||||
68
Client/node_modules/vscode-languageclient/lib/typeDefinition.js
generated
vendored
Executable file
68
Client/node_modules/vscode-languageclient/lib/typeDefinition.js
generated
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const UUID = require("./utils/uuid");
|
||||
const Is = require("./utils/is");
|
||||
const vscode_1 = require("vscode");
|
||||
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
||||
const client_1 = require("./client");
|
||||
function ensure(target, key) {
|
||||
if (target[key] === void 0) {
|
||||
target[key] = {};
|
||||
}
|
||||
return target[key];
|
||||
}
|
||||
class TypeDefinitionFeature extends client_1.TextDocumentFeature {
|
||||
constructor(client) {
|
||||
super(client, vscode_languageserver_protocol_1.TypeDefinitionRequest.type);
|
||||
}
|
||||
fillClientCapabilities(capabilites) {
|
||||
ensure(ensure(capabilites, 'textDocument'), 'typeDefinition').dynamicRegistration = true;
|
||||
}
|
||||
initialize(capabilities, documentSelector) {
|
||||
if (!capabilities.typeDefinitionProvider) {
|
||||
return;
|
||||
}
|
||||
if (capabilities.typeDefinitionProvider === true) {
|
||||
if (!documentSelector) {
|
||||
return;
|
||||
}
|
||||
this.register(this.messages, {
|
||||
id: UUID.generateUuid(),
|
||||
registerOptions: Object.assign({}, { documentSelector: documentSelector })
|
||||
});
|
||||
}
|
||||
else {
|
||||
const implCapabilities = capabilities.typeDefinitionProvider;
|
||||
const id = Is.string(implCapabilities.id) && implCapabilities.id.length > 0 ? implCapabilities.id : UUID.generateUuid();
|
||||
const selector = implCapabilities.documentSelector || documentSelector;
|
||||
if (selector) {
|
||||
this.register(this.messages, {
|
||||
id,
|
||||
registerOptions: Object.assign({}, { documentSelector: selector })
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
registerLanguageProvider(options) {
|
||||
let client = this._client;
|
||||
let provideTypeDefinition = (document, position, token) => {
|
||||
return client.sendRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDefinitionResult, (error) => {
|
||||
client.logFailedRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, error);
|
||||
return Promise.resolve(null);
|
||||
});
|
||||
};
|
||||
let middleware = client.clientOptions.middleware;
|
||||
return vscode_1.languages.registerTypeDefinitionProvider(options.documentSelector, {
|
||||
provideTypeDefinition: (document, position, token) => {
|
||||
return middleware.provideTypeDefinition
|
||||
? middleware.provideTypeDefinition(document, position, token, provideTypeDefinition)
|
||||
: provideTypeDefinition(document, position, token);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.TypeDefinitionFeature = TypeDefinitionFeature;
|
||||
16
Client/node_modules/vscode-languageclient/lib/utils/async.d.ts
generated
vendored
Executable file
16
Client/node_modules/vscode-languageclient/lib/utils/async.d.ts
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
export interface ITask<T> {
|
||||
(): T;
|
||||
}
|
||||
export declare class Delayer<T> {
|
||||
defaultDelay: number;
|
||||
private timeout;
|
||||
private completionPromise;
|
||||
private onSuccess;
|
||||
private task;
|
||||
constructor(defaultDelay: number);
|
||||
trigger(task: ITask<T>, delay?: number): Promise<T>;
|
||||
forceDelivery(): T | undefined;
|
||||
isTriggered(): boolean;
|
||||
cancel(): void;
|
||||
private cancelTimeout;
|
||||
}
|
||||
64
Client/node_modules/vscode-languageclient/lib/utils/async.js
generated
vendored
Executable file
64
Client/node_modules/vscode-languageclient/lib/utils/async.js
generated
vendored
Executable file
@@ -0,0 +1,64 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class Delayer {
|
||||
constructor(defaultDelay) {
|
||||
this.defaultDelay = defaultDelay;
|
||||
this.timeout = undefined;
|
||||
this.completionPromise = undefined;
|
||||
this.onSuccess = undefined;
|
||||
this.task = undefined;
|
||||
}
|
||||
trigger(task, delay = this.defaultDelay) {
|
||||
this.task = task;
|
||||
if (delay >= 0) {
|
||||
this.cancelTimeout();
|
||||
}
|
||||
if (!this.completionPromise) {
|
||||
this.completionPromise = new Promise((resolve) => {
|
||||
this.onSuccess = resolve;
|
||||
}).then(() => {
|
||||
this.completionPromise = undefined;
|
||||
this.onSuccess = undefined;
|
||||
var result = this.task();
|
||||
this.task = undefined;
|
||||
return result;
|
||||
});
|
||||
}
|
||||
if (delay >= 0 || this.timeout === void 0) {
|
||||
this.timeout = setTimeout(() => {
|
||||
this.timeout = undefined;
|
||||
this.onSuccess(undefined);
|
||||
}, delay >= 0 ? delay : this.defaultDelay);
|
||||
}
|
||||
return this.completionPromise;
|
||||
}
|
||||
forceDelivery() {
|
||||
if (!this.completionPromise) {
|
||||
return undefined;
|
||||
}
|
||||
this.cancelTimeout();
|
||||
let result = this.task();
|
||||
this.completionPromise = undefined;
|
||||
this.onSuccess = undefined;
|
||||
this.task = undefined;
|
||||
return result;
|
||||
}
|
||||
isTriggered() {
|
||||
return this.timeout !== void 0;
|
||||
}
|
||||
cancel() {
|
||||
this.cancelTimeout();
|
||||
this.completionPromise = undefined;
|
||||
}
|
||||
cancelTimeout() {
|
||||
if (this.timeout !== void 0) {
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Delayer = Delayer;
|
||||
9
Client/node_modules/vscode-languageclient/lib/utils/electron.d.ts
generated
vendored
Executable file
9
Client/node_modules/vscode-languageclient/lib/utils/electron.d.ts
generated
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
import * as cp from 'child_process';
|
||||
export interface IForkOpts {
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
encoding?: string;
|
||||
execArgv?: string[];
|
||||
}
|
||||
export declare function fork(modulePath: string, args: string[], options: IForkOpts, callback: (error: any, cp: cp.ChildProcess | undefined) => void): void;
|
||||
101
Client/node_modules/vscode-languageclient/lib/utils/electron.js
generated
vendored
Executable file
101
Client/node_modules/vscode-languageclient/lib/utils/electron.js
generated
vendored
Executable file
@@ -0,0 +1,101 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const os = require("os");
|
||||
const net = require("net");
|
||||
const cp = require("child_process");
|
||||
function makeRandomHexString(length) {
|
||||
let chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
||||
let result = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
let idx = Math.floor(chars.length * Math.random());
|
||||
result += chars[idx];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function generatePipeName() {
|
||||
let randomName = 'vscode-lang-' + makeRandomHexString(40);
|
||||
if (process.platform === 'win32') {
|
||||
return '\\\\.\\pipe\\' + randomName + '-sock';
|
||||
}
|
||||
// Mac/Unix: use socket file
|
||||
return path.join(os.tmpdir(), randomName + '.sock');
|
||||
}
|
||||
function generatePatchedEnv(env, stdInPipeName, stdOutPipeName) {
|
||||
// Set the two unique pipe names and the electron flag as process env
|
||||
let newEnv = {};
|
||||
for (let key in env) {
|
||||
newEnv[key] = env[key];
|
||||
}
|
||||
newEnv['STDIN_PIPE_NAME'] = stdInPipeName;
|
||||
newEnv['STDOUT_PIPE_NAME'] = stdOutPipeName;
|
||||
newEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1';
|
||||
newEnv['ELECTRON_RUN_AS_NODE'] = '1';
|
||||
return newEnv;
|
||||
}
|
||||
function fork(modulePath, args, options, callback) {
|
||||
let callbackCalled = false;
|
||||
let resolve = (result) => {
|
||||
if (callbackCalled) {
|
||||
return;
|
||||
}
|
||||
callbackCalled = true;
|
||||
callback(undefined, result);
|
||||
};
|
||||
let reject = (err) => {
|
||||
if (callbackCalled) {
|
||||
return;
|
||||
}
|
||||
callbackCalled = true;
|
||||
callback(err, undefined);
|
||||
};
|
||||
// Generate two unique pipe names
|
||||
let stdInPipeName = generatePipeName();
|
||||
let stdOutPipeName = generatePipeName();
|
||||
let newEnv = generatePatchedEnv(options.env || process.env, stdInPipeName, stdOutPipeName);
|
||||
let childProcess;
|
||||
// Begin listening to stdout pipe
|
||||
let stdOutServer = net.createServer((stdOutStream) => {
|
||||
// The child process will write exactly one chunk with content `ready` when it has installed a listener to the stdin pipe
|
||||
stdOutStream.once('data', (_chunk) => {
|
||||
// The child process is sending me the `ready` chunk, time to connect to the stdin pipe
|
||||
childProcess.stdin = net.connect(stdInPipeName);
|
||||
// From now on the childProcess.stdout is available for reading
|
||||
childProcess.stdout = stdOutStream;
|
||||
resolve(childProcess);
|
||||
});
|
||||
});
|
||||
stdOutServer.listen(stdOutPipeName);
|
||||
let serverClosed = false;
|
||||
let closeServer = () => {
|
||||
if (serverClosed) {
|
||||
return;
|
||||
}
|
||||
serverClosed = true;
|
||||
process.removeListener('exit', closeServer);
|
||||
stdOutServer.close();
|
||||
};
|
||||
// Create the process
|
||||
let bootstrapperPath = path.join(__dirname, 'electronForkStart');
|
||||
childProcess = cp.fork(bootstrapperPath, [modulePath].concat(args), {
|
||||
silent: true,
|
||||
cwd: options.cwd,
|
||||
env: newEnv,
|
||||
execArgv: options.execArgv
|
||||
});
|
||||
childProcess.once('error', (err) => {
|
||||
closeServer();
|
||||
reject(err);
|
||||
});
|
||||
childProcess.once('exit', (err) => {
|
||||
closeServer();
|
||||
reject(err);
|
||||
});
|
||||
// On exit still close server
|
||||
process.once('exit', closeServer);
|
||||
}
|
||||
exports.fork = fork;
|
||||
5
Client/node_modules/vscode-languageclient/lib/utils/electronForkStart.d.ts
generated
vendored
Executable file
5
Client/node_modules/vscode-languageclient/lib/utils/electronForkStart.d.ts
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
declare var net: any, fs: any, stream: any, util: any;
|
||||
declare var ENABLE_LOGGING: boolean;
|
||||
declare var log: (str: string) => void;
|
||||
declare var stdInPipeName: string | undefined;
|
||||
declare var stdOutPipeName: string | undefined;
|
||||
147
Client/node_modules/vscode-languageclient/lib/utils/electronForkStart.js
generated
vendored
Executable file
147
Client/node_modules/vscode-languageclient/lib/utils/electronForkStart.js
generated
vendored
Executable file
@@ -0,0 +1,147 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
var net = require('net'), fs = require('fs'), stream = require('stream'), util = require('util');
|
||||
var ENABLE_LOGGING = false;
|
||||
var log = (function () {
|
||||
if (!ENABLE_LOGGING) {
|
||||
return function () { };
|
||||
}
|
||||
var isFirst = true;
|
||||
var LOG_LOCATION = 'C:\\stdFork.log';
|
||||
return function log(str) {
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
fs.writeFileSync(LOG_LOCATION, str + '\n');
|
||||
return;
|
||||
}
|
||||
fs.appendFileSync(LOG_LOCATION, str + '\n');
|
||||
};
|
||||
})();
|
||||
var stdInPipeName = process.env['STDIN_PIPE_NAME'];
|
||||
var stdOutPipeName = process.env['STDOUT_PIPE_NAME'];
|
||||
log('STDIN_PIPE_NAME: ' + stdInPipeName);
|
||||
log('STDOUT_PIPE_NAME: ' + stdOutPipeName);
|
||||
log('ATOM_SHELL_INTERNAL_RUN_AS_NODE: ' + process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE']);
|
||||
// stdout redirection to named pipe
|
||||
(function () {
|
||||
log('Beginning stdout redirection...');
|
||||
// Create a writing stream to the stdout pipe
|
||||
var stdOutStream = net.connect(stdOutPipeName);
|
||||
// unref stdOutStream to behave like a normal standard out
|
||||
stdOutStream.unref();
|
||||
// handle process.stdout
|
||||
process.__defineGetter__('stdout', function () { return stdOutStream; });
|
||||
// handle process.stderr
|
||||
process.__defineGetter__('stderr', function () { return stdOutStream; });
|
||||
var fsWriteSyncString = function (fd, str, _position, encoding) {
|
||||
// fs.writeSync(fd, string[, position[, encoding]]);
|
||||
var buf = new Buffer(str, encoding || 'utf8');
|
||||
return fsWriteSyncBuffer(fd, buf, 0, buf.length);
|
||||
};
|
||||
var fsWriteSyncBuffer = function (_fd, buffer, off, len) {
|
||||
off = Math.abs(off | 0);
|
||||
len = Math.abs(len | 0);
|
||||
// fs.writeSync(fd, buffer, offset, length[, position]);
|
||||
var buffer_length = buffer.length;
|
||||
if (off > buffer_length) {
|
||||
throw new Error('offset out of bounds');
|
||||
}
|
||||
if (len > buffer_length) {
|
||||
throw new Error('length out of bounds');
|
||||
}
|
||||
if (((off + len) | 0) < off) {
|
||||
throw new Error('off + len overflow');
|
||||
}
|
||||
if (buffer_length - off < len) {
|
||||
// Asking for more than is left over in the buffer
|
||||
throw new Error('off + len > buffer.length');
|
||||
}
|
||||
var slicedBuffer = buffer;
|
||||
if (off !== 0 || len !== buffer_length) {
|
||||
slicedBuffer = buffer.slice(off, off + len);
|
||||
}
|
||||
stdOutStream.write(slicedBuffer);
|
||||
return slicedBuffer.length;
|
||||
};
|
||||
// handle fs.writeSync(1, ...)
|
||||
var originalWriteSync = fs.writeSync;
|
||||
fs.writeSync = function (fd, data, _position, _encoding) {
|
||||
if (fd !== 1) {
|
||||
return originalWriteSync.apply(fs, arguments);
|
||||
}
|
||||
// usage:
|
||||
// fs.writeSync(fd, buffer, offset, length[, position]);
|
||||
// OR
|
||||
// fs.writeSync(fd, string[, position[, encoding]]);
|
||||
if (data instanceof Buffer) {
|
||||
return fsWriteSyncBuffer.apply(null, arguments);
|
||||
}
|
||||
// For compatibility reasons with fs.writeSync, writing null will write "null", etc
|
||||
if (typeof data !== 'string') {
|
||||
data += '';
|
||||
}
|
||||
return fsWriteSyncString.apply(null, arguments);
|
||||
};
|
||||
log('Finished defining process.stdout, process.stderr and fs.writeSync');
|
||||
})();
|
||||
// stdin redirection to named pipe
|
||||
(function () {
|
||||
// Begin listening to stdin pipe
|
||||
var server = net.createServer(function (stream) {
|
||||
// Stop accepting new connections, keep the existing one alive
|
||||
server.close();
|
||||
log('Parent process has connected to my stdin. All should be good now.');
|
||||
// handle process.stdin
|
||||
process.__defineGetter__('stdin', function () {
|
||||
return stream;
|
||||
});
|
||||
// Remove myself from process.argv
|
||||
process.argv.splice(1, 1);
|
||||
// Load the actual program
|
||||
var program = process.argv[1];
|
||||
log('Loading program: ' + program);
|
||||
// Unset the custom environmental variables that should not get inherited
|
||||
delete process.env['STDIN_PIPE_NAME'];
|
||||
delete process.env['STDOUT_PIPE_NAME'];
|
||||
delete process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
|
||||
delete process.env['ELECTRON_RUN_AS_NODE'];
|
||||
require(program);
|
||||
log('Finished loading program.');
|
||||
var stdinIsReferenced = true;
|
||||
var timer = setInterval(function () {
|
||||
var listenerCount = (stream.listeners('data').length +
|
||||
stream.listeners('end').length +
|
||||
stream.listeners('close').length +
|
||||
stream.listeners('error').length);
|
||||
// log('listenerCount: ' + listenerCount);
|
||||
if (listenerCount <= 1) {
|
||||
// No more "actual" listeners, only internal node
|
||||
if (stdinIsReferenced) {
|
||||
stdinIsReferenced = false;
|
||||
// log('unreferencing stream!!!');
|
||||
stream.unref();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// There are "actual" listeners
|
||||
if (!stdinIsReferenced) {
|
||||
stdinIsReferenced = true;
|
||||
stream.ref();
|
||||
}
|
||||
}
|
||||
// log(
|
||||
// '' + stream.listeners('data').length +
|
||||
// ' ' + stream.listeners('end').length +
|
||||
// ' ' + stream.listeners('close').length +
|
||||
// ' ' + stream.listeners('error').length
|
||||
// );
|
||||
}, 1000);
|
||||
timer.unref();
|
||||
});
|
||||
server.listen(stdInPipeName, function () {
|
||||
// signal via stdout that the parent process can now begin writing to stdin pipe
|
||||
process.stdout.write('ready');
|
||||
});
|
||||
})();
|
||||
9
Client/node_modules/vscode-languageclient/lib/utils/is.d.ts
generated
vendored
Executable file
9
Client/node_modules/vscode-languageclient/lib/utils/is.d.ts
generated
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
export declare function boolean(value: any): value is boolean;
|
||||
export declare function string(value: any): value is string;
|
||||
export declare function number(value: any): value is number;
|
||||
export declare function error(value: any): value is Error;
|
||||
export declare function func(value: any): value is Function;
|
||||
export declare function array<T>(value: any): value is T[];
|
||||
export declare function stringArray(value: any): value is string[];
|
||||
export declare function typedArray<T>(value: any, check: (value: any) => boolean): value is T[];
|
||||
export declare function thenable<T>(value: any): value is Thenable<T>;
|
||||
43
Client/node_modules/vscode-languageclient/lib/utils/is.js
generated
vendored
Executable file
43
Client/node_modules/vscode-languageclient/lib/utils/is.js
generated
vendored
Executable file
@@ -0,0 +1,43 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const toString = Object.prototype.toString;
|
||||
function boolean(value) {
|
||||
return value === true || value === false;
|
||||
}
|
||||
exports.boolean = boolean;
|
||||
function string(value) {
|
||||
return toString.call(value) === '[object String]';
|
||||
}
|
||||
exports.string = string;
|
||||
function number(value) {
|
||||
return toString.call(value) === '[object Number]';
|
||||
}
|
||||
exports.number = number;
|
||||
function error(value) {
|
||||
return toString.call(value) === '[object Error]';
|
||||
}
|
||||
exports.error = error;
|
||||
function func(value) {
|
||||
return toString.call(value) === '[object Function]';
|
||||
}
|
||||
exports.func = func;
|
||||
function array(value) {
|
||||
return Array.isArray(value);
|
||||
}
|
||||
exports.array = array;
|
||||
function stringArray(value) {
|
||||
return array(value) && value.every(elem => string(elem));
|
||||
}
|
||||
exports.stringArray = stringArray;
|
||||
function typedArray(value, check) {
|
||||
return Array.isArray(value) && value.every(check);
|
||||
}
|
||||
exports.typedArray = typedArray;
|
||||
function thenable(value) {
|
||||
return value && func(value.then);
|
||||
}
|
||||
exports.thenable = thenable;
|
||||
4
Client/node_modules/vscode-languageclient/lib/utils/processes.d.ts
generated
vendored
Executable file
4
Client/node_modules/vscode-languageclient/lib/utils/processes.d.ts
generated
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import * as cp from 'child_process';
|
||||
import ChildProcess = cp.ChildProcess;
|
||||
export declare function terminate(process: ChildProcess, cwd?: string): boolean;
|
||||
46
Client/node_modules/vscode-languageclient/lib/utils/processes.js
generated
vendored
Executable file
46
Client/node_modules/vscode-languageclient/lib/utils/processes.js
generated
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const cp = require("child_process");
|
||||
const path_1 = require("path");
|
||||
const isWindows = (process.platform === 'win32');
|
||||
const isMacintosh = (process.platform === 'darwin');
|
||||
const isLinux = (process.platform === 'linux');
|
||||
function terminate(process, cwd) {
|
||||
if (isWindows) {
|
||||
try {
|
||||
// This we run in Atom execFileSync is available.
|
||||
// Ignore stderr since this is otherwise piped to parent.stderr
|
||||
// which might be already closed.
|
||||
let options = {
|
||||
stdio: ['pipe', 'pipe', 'ignore']
|
||||
};
|
||||
if (cwd) {
|
||||
options.cwd = cwd;
|
||||
}
|
||||
cp.execFileSync('taskkill', ['/T', '/F', '/PID', process.pid.toString()], options);
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (isLinux || isMacintosh) {
|
||||
try {
|
||||
var cmd = path_1.join(__dirname, 'terminateProcess.sh');
|
||||
var result = cp.spawnSync(cmd, [process.pid.toString()]);
|
||||
return result.error ? false : true;
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
process.kill('SIGKILL');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
exports.terminate = terminate;
|
||||
16
Client/node_modules/vscode-languageclient/lib/utils/terminateProcess.sh
generated
vendored
Executable file
16
Client/node_modules/vscode-languageclient/lib/utils/terminateProcess.sh
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
terminateTree() {
|
||||
for cpid in $(pgrep -P $1); do
|
||||
terminateTree $cpid
|
||||
done
|
||||
kill -9 $1 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
for pid in $*; do
|
||||
terminateTree $pid
|
||||
done
|
||||
22
Client/node_modules/vscode-languageclient/lib/utils/uuid.d.ts
generated
vendored
Executable file
22
Client/node_modules/vscode-languageclient/lib/utils/uuid.d.ts
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Represents a UUID as defined by rfc4122.
|
||||
*/
|
||||
export interface UUID {
|
||||
/**
|
||||
* @returns the canonical representation in sets of hexadecimal numbers separated by dashes.
|
||||
*/
|
||||
asHex(): string;
|
||||
equals(other: UUID): boolean;
|
||||
}
|
||||
/**
|
||||
* An empty UUID that contains only zeros.
|
||||
*/
|
||||
export declare const empty: UUID;
|
||||
export declare function v4(): UUID;
|
||||
export declare function isUUID(value: string): boolean;
|
||||
/**
|
||||
* Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
||||
* @param value A uuid string.
|
||||
*/
|
||||
export declare function parse(value: string): UUID;
|
||||
export declare function generateUuid(): string;
|
||||
96
Client/node_modules/vscode-languageclient/lib/utils/uuid.js
generated
vendored
Executable file
96
Client/node_modules/vscode-languageclient/lib/utils/uuid.js
generated
vendored
Executable file
@@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class ValueUUID {
|
||||
constructor(_value) {
|
||||
this._value = _value;
|
||||
// empty
|
||||
}
|
||||
asHex() {
|
||||
return this._value;
|
||||
}
|
||||
equals(other) {
|
||||
return this.asHex() === other.asHex();
|
||||
}
|
||||
}
|
||||
class V4UUID extends ValueUUID {
|
||||
constructor() {
|
||||
super([
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
'-',
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
'-',
|
||||
'4',
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
'-',
|
||||
V4UUID._oneOf(V4UUID._timeHighBits),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
'-',
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
V4UUID._randomHex(),
|
||||
].join(''));
|
||||
}
|
||||
static _oneOf(array) {
|
||||
return array[Math.floor(array.length * Math.random())];
|
||||
}
|
||||
static _randomHex() {
|
||||
return V4UUID._oneOf(V4UUID._chars);
|
||||
}
|
||||
}
|
||||
V4UUID._chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
||||
V4UUID._timeHighBits = ['8', '9', 'a', 'b'];
|
||||
/**
|
||||
* An empty UUID that contains only zeros.
|
||||
*/
|
||||
exports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000');
|
||||
function v4() {
|
||||
return new V4UUID();
|
||||
}
|
||||
exports.v4 = v4;
|
||||
const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
function isUUID(value) {
|
||||
return _UUIDPattern.test(value);
|
||||
}
|
||||
exports.isUUID = isUUID;
|
||||
/**
|
||||
* Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
||||
* @param value A uuid string.
|
||||
*/
|
||||
function parse(value) {
|
||||
if (!isUUID(value)) {
|
||||
throw new Error('invalid uuid');
|
||||
}
|
||||
return new ValueUUID(value);
|
||||
}
|
||||
exports.parse = parse;
|
||||
function generateUuid() {
|
||||
return v4().asHex();
|
||||
}
|
||||
exports.generateUuid = generateUuid;
|
||||
20
Client/node_modules/vscode-languageclient/lib/workspaceFolders.d.ts
generated
vendored
Executable file
20
Client/node_modules/vscode-languageclient/lib/workspaceFolders.d.ts
generated
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
import { WorkspaceFoldersChangeEvent as VWorkspaceFoldersChangeEvent } from 'vscode';
|
||||
import { DynamicFeature, RegistrationData, BaseLanguageClient, NextSignature } from './client';
|
||||
import { ClientCapabilities, InitializeParams, RPCMessageType, ServerCapabilities, WorkspaceFoldersRequest } from 'vscode-languageserver-protocol';
|
||||
export interface WorkspaceFolderWorkspaceMiddleware {
|
||||
workspaceFolders?: WorkspaceFoldersRequest.MiddlewareSignature;
|
||||
didChangeWorkspaceFolders?: NextSignature<VWorkspaceFoldersChangeEvent, void>;
|
||||
}
|
||||
export declare class WorkspaceFoldersFeature implements DynamicFeature<undefined> {
|
||||
private _client;
|
||||
private _listeners;
|
||||
constructor(_client: BaseLanguageClient);
|
||||
readonly messages: RPCMessageType;
|
||||
fillInitializeParams(params: InitializeParams): void;
|
||||
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
||||
initialize(capabilities: ServerCapabilities): void;
|
||||
register(_message: RPCMessageType, data: RegistrationData<undefined>): void;
|
||||
unregister(id: string): void;
|
||||
dispose(): void;
|
||||
private asProtocol;
|
||||
}
|
||||
111
Client/node_modules/vscode-languageclient/lib/workspaceFolders.js
generated
vendored
Executable file
111
Client/node_modules/vscode-languageclient/lib/workspaceFolders.js
generated
vendored
Executable file
@@ -0,0 +1,111 @@
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const UUID = require("./utils/uuid");
|
||||
const vscode_1 = require("vscode");
|
||||
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
||||
function access(target, key) {
|
||||
if (target === void 0) {
|
||||
return undefined;
|
||||
}
|
||||
return target[key];
|
||||
}
|
||||
class WorkspaceFoldersFeature {
|
||||
constructor(_client) {
|
||||
this._client = _client;
|
||||
this._listeners = new Map();
|
||||
}
|
||||
get messages() {
|
||||
return vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type;
|
||||
}
|
||||
fillInitializeParams(params) {
|
||||
let folders = vscode_1.workspace.workspaceFolders;
|
||||
if (folders === void 0) {
|
||||
params.workspaceFolders = null;
|
||||
}
|
||||
else {
|
||||
params.workspaceFolders = folders.map(folder => this.asProtocol(folder));
|
||||
}
|
||||
}
|
||||
fillClientCapabilities(capabilities) {
|
||||
capabilities.workspace = capabilities.workspace || {};
|
||||
capabilities.workspace.workspaceFolders = true;
|
||||
}
|
||||
initialize(capabilities) {
|
||||
let client = this._client;
|
||||
client.onRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type, (token) => {
|
||||
let workspaceFolders = () => {
|
||||
let folders = vscode_1.workspace.workspaceFolders;
|
||||
if (folders === void 0) {
|
||||
return null;
|
||||
}
|
||||
let result = folders.map((folder) => {
|
||||
return this.asProtocol(folder);
|
||||
});
|
||||
return result;
|
||||
};
|
||||
let middleware = client.clientOptions.middleware.workspace;
|
||||
return middleware && middleware.workspaceFolders
|
||||
? middleware.workspaceFolders(token, workspaceFolders)
|
||||
: workspaceFolders(token);
|
||||
});
|
||||
let value = access(access(access(capabilities, 'workspace'), 'workspaceFolders'), 'changeNotifications');
|
||||
let id;
|
||||
if (typeof value === 'string') {
|
||||
id = value;
|
||||
}
|
||||
else if (value === true) {
|
||||
id = UUID.generateUuid();
|
||||
}
|
||||
if (id) {
|
||||
this.register(this.messages, {
|
||||
id: id,
|
||||
registerOptions: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
register(_message, data) {
|
||||
let id = data.id;
|
||||
let client = this._client;
|
||||
let disposable = vscode_1.workspace.onDidChangeWorkspaceFolders((event) => {
|
||||
let didChangeWorkspaceFolders = (event) => {
|
||||
let params = {
|
||||
event: {
|
||||
added: event.added.map(folder => this.asProtocol(folder)),
|
||||
removed: event.removed.map(folder => this.asProtocol(folder))
|
||||
}
|
||||
};
|
||||
this._client.sendNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, params);
|
||||
};
|
||||
let middleware = client.clientOptions.middleware.workspace;
|
||||
middleware && middleware.didChangeWorkspaceFolders
|
||||
? middleware.didChangeWorkspaceFolders(event, didChangeWorkspaceFolders)
|
||||
: didChangeWorkspaceFolders(event);
|
||||
});
|
||||
this._listeners.set(id, disposable);
|
||||
}
|
||||
unregister(id) {
|
||||
let disposable = this._listeners.get(id);
|
||||
if (disposable === void 0) {
|
||||
return;
|
||||
}
|
||||
this._listeners.delete(id);
|
||||
disposable.dispose();
|
||||
}
|
||||
dispose() {
|
||||
for (let disposable of this._listeners.values()) {
|
||||
disposable.dispose();
|
||||
}
|
||||
this._listeners.clear();
|
||||
}
|
||||
asProtocol(workspaceFolder) {
|
||||
if (workspaceFolder === void 0) {
|
||||
return null;
|
||||
}
|
||||
return { uri: this._client.code2ProtocolConverter.asUri(workspaceFolder.uri), name: workspaceFolder.name };
|
||||
}
|
||||
}
|
||||
exports.WorkspaceFoldersFeature = WorkspaceFoldersFeature;
|
||||
Reference in New Issue
Block a user