public class CommandUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CommandUtil.CommandArgument
Inner class for the command argument holding argument key and argument value.
|
Modifier and Type | Method and Description |
---|---|
static org.eclipse.lsp4j.ApplyWorkspaceEditParams |
applySingleTextEdit(String editText,
org.eclipse.lsp4j.Range range,
org.eclipse.lsp4j.VersionedTextDocumentIdentifier identifier,
org.eclipse.lsp4j.services.LanguageClient client)
Apply a given single text edit.
|
static Object |
applyWorkspaceEdit(List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.TextDocumentEdit,org.eclipse.lsp4j.ResourceOperation>> documentChanges,
org.eclipse.lsp4j.services.LanguageClient client)
Apply a workspace edit for the current instance.
|
static void |
clearDiagnostics(org.eclipse.lsp4j.services.LanguageClient client,
LSCompiler lsCompiler,
DiagnosticsHelper diagnosticsHelper,
String documentUri)
Clears diagnostics of the client by sending an text edit event.
|
static org.apache.commons.lang3.tuple.Pair<BLangNode,Object> |
getBLangNode(int line,
int column,
String uri,
WorkspaceDocumentManager documentManager,
LSCompiler lsCompiler,
LSContext context) |
static List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Command,org.eclipse.lsp4j.CodeAction>> |
getCommandForNodeType(String topLevelNodeType,
String docUri,
int line)
Get the commands for the given node type.
|
static List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Command,org.eclipse.lsp4j.CodeAction>> |
getCommandsByDiagnostic(org.eclipse.lsp4j.Diagnostic diagnostic,
org.eclipse.lsp4j.CodeActionParams params)
Get the command instances for a given diagnostic.
|
static BLangInvocation |
getFunctionNode(int line,
int column,
String uri,
WorkspaceDocumentManager documentManager,
LSCompiler lsCompiler,
LSContext context) |
static String |
getObjectConstructorSnippet(List<BLangSimpleVariable> fields,
int baseOffset)
Get the object constructor snippet generated from public object fields.
|
static List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Command,org.eclipse.lsp4j.CodeAction>> |
getTestGenerationCommand(String topLevelNodeType,
String docUri,
org.eclipse.lsp4j.CodeActionParams params,
WorkspaceDocumentManager documentManager,
LSCompiler lsCompiler)
Get the command for generate test class.
|
static void |
notifyClient(org.eclipse.lsp4j.services.LanguageClient client,
org.eclipse.lsp4j.MessageType messageType,
String message)
Sends a message to the language server client.
|
public static List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Command,org.eclipse.lsp4j.CodeAction>> getCommandForNodeType(String topLevelNodeType, String docUri, int line)
topLevelNodeType
- Node TypedocUri
- Document URIline
- Node lineList
List of commands for the linepublic static List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Command,org.eclipse.lsp4j.CodeAction>> getTestGenerationCommand(String topLevelNodeType, String docUri, org.eclipse.lsp4j.CodeActionParams params, WorkspaceDocumentManager documentManager, LSCompiler lsCompiler)
topLevelNodeType
- top level nodedocUri
- Document Uriparams
- Code action parametersdocumentManager
- Document managerlsCompiler
- LS CompilerCommand
Test Generation commandpublic static List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Command,org.eclipse.lsp4j.CodeAction>> getCommandsByDiagnostic(org.eclipse.lsp4j.Diagnostic diagnostic, org.eclipse.lsp4j.CodeActionParams params)
diagnostic
- Diagnostic to get the command againstparams
- Code Action parametersList
List of commands related to the given diagnosticpublic static String getObjectConstructorSnippet(List<BLangSimpleVariable> fields, int baseOffset)
fields
- List of FieldsbaseOffset
- Offset of snippetString
Constructor snippet as Stringpublic static void notifyClient(org.eclipse.lsp4j.services.LanguageClient client, org.eclipse.lsp4j.MessageType messageType, String message)
client
- Language Server clientmessageType
- message typemessage
- messagepublic static void clearDiagnostics(org.eclipse.lsp4j.services.LanguageClient client, LSCompiler lsCompiler, DiagnosticsHelper diagnosticsHelper, String documentUri)
client
- Language Server clientlsCompiler
- Language Server Compiler instancediagnosticsHelper
- diagnostics helperdocumentUri
- Current text document URIpublic static org.eclipse.lsp4j.ApplyWorkspaceEditParams applySingleTextEdit(String editText, org.eclipse.lsp4j.Range range, org.eclipse.lsp4j.VersionedTextDocumentIdentifier identifier, org.eclipse.lsp4j.services.LanguageClient client)
editText
- Edit text to be insertedrange
- Line Range to be processedidentifier
- Document identifierclient
- Language ClientApplyWorkspaceEditParams
Workspace edit paramspublic static Object applyWorkspaceEdit(List<org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.TextDocumentEdit,org.eclipse.lsp4j.ResourceOperation>> documentChanges, org.eclipse.lsp4j.services.LanguageClient client)
documentChanges
- List of either document edits or set of resource changes for current sessionclient
- Language ClientObject
workspace edit parameterspublic static BLangInvocation getFunctionNode(int line, int column, String uri, WorkspaceDocumentManager documentManager, LSCompiler lsCompiler, LSContext context)
public static org.apache.commons.lang3.tuple.Pair<BLangNode,Object> getBLangNode(int line, int column, String uri, WorkspaceDocumentManager documentManager, LSCompiler lsCompiler, LSContext context)
Copyright © 2019 WSO2. All rights reserved.