internal async Task CreateAsync() { await languageServer.SendRequest( NewCustomViewRequest.Method, new NewCustomViewRequest { Id = this.Id, Title = this.Title, ViewType = this.ViewType, } ); }
public static async Task UnregisterCapability(this ILanguageServer mediator, UnregistrationParams @params) { try { await mediator.SendRequest("client/unregisterCapability", @params); } catch (Exception e) { // VsCode today does not implement LSP properly. await mediator.SendRequest("client/unregisterFeature", @params); } }
public async Task <string> PromptInputAsync(string message) { // The VSCode client currently doesn't use the Label field, so we ignore it ShowInputPromptResponse response = await _languageServer.SendRequest <ShowInputPromptRequest, ShowInputPromptResponse>( "powerShell/showInputPrompt", new ShowInputPromptRequest { Name = message, }); if (response.PromptCancelled) { return(null); } return(response.ResponseText); }
public async Task InitializeAsync(ILanguageServer server) { var documents = await server.SendRequest <IEnumerable <TextDocumentItem> >(GetAllDocumentsMethod); foreach (var doc in documents) { this.DocumentAdded(doc.Uri.AbsolutePath, new ThrowTextLoader()); } }
public async Task <ILspCurrentFileContext> GetCurrentLspFileContextAsync() { ClientEditorContext clientContext = await _languageServer.SendRequest <GetEditorContextRequest, ClientEditorContext>( "editor/getEditorContext", new GetEditorContextRequest()).ConfigureAwait(false); return(new LspCurrentFileContext(clientContext)); }
protected override void ShowFieldPrompt(FieldDetails fieldDetails) { base.ShowFieldPrompt(fieldDetails); _languageServer.SendRequest <ShowInputPromptRequest, ShowInputPromptResponse>( "powerShell/showInputPrompt", new ShowInputPromptRequest { Name = fieldDetails.Name, Label = fieldDetails.Label }).ContinueWith(HandlePromptResponse) .ConfigureAwait(false); }
protected override void ShowPrompt(PromptStyle promptStyle) { base.ShowPrompt(promptStyle); _languageServer.SendRequest <ShowChoicePromptRequest, ShowChoicePromptResponse>( "powerShell/showChoicePrompt", new ShowChoicePromptRequest { IsMultiChoice = this.IsMultiChoice, Caption = this.Caption, Message = this.Message, Choices = this.Choices, DefaultChoices = this.DefaultChoices }) .ContinueWith(HandlePromptResponse) .ConfigureAwait(false); }
public Task <Unit> Handle(DidChangeTextDocumentParams request, CancellationToken cancellationToken) { var documentPath = request.TextDocument.Uri.ToString(); var text = request.ContentChanges.FirstOrDefault()?.Text; _bufferManager.UpdateBuffer(documentPath, text); _languageServer.SendRequest( new PublishDiagnosticsParams() { Uri = request.TextDocument.Uri }, cancellationToken); _languageServer.Window.LogInfo( $"Updated buffer for document: {documentPath}"); return(Unit.Task); }
public async Task <EditorContext> GetEditorContextAsync() { if (!TestHasLanguageServer()) { return(null); } ; ClientEditorContext clientContext = await _languageServer.SendRequest <GetEditorContextRequest, ClientEditorContext>( "editor/getEditorContext", new GetEditorContextRequest()).ConfigureAwait(false); return(this.ConvertClientEditorContext(clientContext)); }
public async Task <EditorContext> GetEditorContextAsync() { ClientEditorContext clientContext = await _languageServer.SendRequest <GetEditorContextRequest, ClientEditorContext>( "editor/getEditorContext", new GetEditorContextRequest()); return(this.ConvertClientEditorContext(clientContext)); }
public static Task <MessageActionItem> ShowMessage(this ILanguageServer mediator, ShowMessageRequestParams @params) { return(mediator.SendRequest <ShowMessageRequestParams, MessageActionItem>("window/showMessageRequest", @params)); }
public static Task <ApplyWorkspaceEditResponse> ApplyEdit(this ILanguageServer mediator, ApplyWorkspaceEditParams @params) { return(mediator.SendRequest <ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse>("workspace/applyEdit", @params)); }
public Task SendRequestAsync(string method) { return(_languageServer.SendRequest(method).ReturningVoid(CancellationToken.None)); }
public Task SendRequestAsync(string method) { return(_languageServer.SendRequest <Unit>(method)); }