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.
C#
public class LanguageServer
Inheritance
LanguageServer

Constructors

Properties

NL2FxImplementation

If set, provides the handler for $/nlSuggestion message.

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)

Received 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.

OnDidChange

Applies to

Product Versions
Power Fx SDK Latest