Udostępnij przez


LanguageServer Class

Definition

PowerFx Language server implementation

LanguageServer can receive request/notification payload from client, it can also send request/notification to client.

LanguageServer is hosted inside WebSocket or HTTP/HTTPS service

  • For WebSocket, OnDataReceived() is for incoming traffic, SendToClient() is for outgoing traffic
  • For HTTP/HTTPS, OnDataReceived() is for HTTP/HTTPS request, SendToClient() is queued up in next HTTP/HTTPS response.
public class LanguageServer
type LanguageServer = class
Public Class LanguageServer
Inheritance
LanguageServer

Constructors

LanguageServer(IPowerFxScopeFactory, IHostTaskExecutor, ILanguageServerLogger)
LanguageServer(LanguageServer+SendToClient, IPowerFxScopeFactory, Action<String>)

Fields

Nl2FxDummyFormula

This const represents the dummy formula that is used to create an infrastructure needed to get the symbols for Nl2Fx operation.

Properties

NL2FxImplementation
Obsolete.

If set, provides the handler for $/nlSuggestion message. Note: This is not a thread safe. Consider using the NlHandlerFactory.

NLHandlerFactory

A factory to get the NLHandler from the given scope.

Methods

GetCharPosition(String, Int32)

Get the charactor position (starts with 1) from its line. e.g. "123\n1{2}3" ==> 2 ({x} is the input char at position) "12{\n}123" ==> 3 ('\n' belongs to the previous line "12\n", the last char is '2' with index of 3).

GetPosition(String, Int32, Int32)

Get the position offset (starts with 0) in Expression from line/character (starts with 0) e.g. "123", line:0, char:1 => 1.

GetRange(String, Span)

Construct a Range based on a Span for a given expression.

OnDataReceived(String)
Obsolete.

Received request/notification payload from client. Note: Do not use this overload. Move to using OnDataReceivedAsync overloads. Note: This only exists for backward compatibility and runs synchronously which could affect performance.

OnDataReceivedAsync(LanguageServerInput, CancellationToken)

Asynchronously process the incoming request/notification payload from client.

OnDataReceivedAsync(String, CancellationToken)

Asynchronously process the incoming request/notification payload from client.

Events

LogUnhandledExceptionHandler

Callback for host to get notified of unhandled exceptions that are happening asynchronously. This should be used for logging purposes. This exists only for backward compat reasons now

OnDidChange

Applies to