Java Code Examples for org.eclipse.lsp4j.Command#setArguments()

The following examples show how to use org.eclipse.lsp4j.Command#setArguments() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeActionProvider.java    From vscode-as3mxml with Apache License 2.0 6 votes vote down vote up
private void findSourceActions(Path path, List<Either<Command, CodeAction>> codeActions)
{
    Command organizeCommand = new Command();
    organizeCommand.setTitle("Organize Imports");
    organizeCommand.setCommand(ICommandConstants.ORGANIZE_IMPORTS_IN_URI);
    JsonObject uri = new JsonObject();
    uri.addProperty("external", path.toUri().toString());
    organizeCommand.setArguments(Lists.newArrayList(
        uri
    ));
    CodeAction organizeImports = new CodeAction();
    organizeImports.setKind(CodeActionKind.SourceOrganizeImports);
    organizeImports.setTitle(organizeCommand.getTitle());
    organizeImports.setCommand(organizeCommand);
    codeActions.add(Either.forRight(organizeImports));
}
 
Example 2
Source File: CodeActionAcceptor.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** Adds a quick-fix code action with the given title and command created of commandID and arguments */
public void acceptQuickfixCommand(QuickfixContext context, String title, String commandID, List<Object> arguments) {
	Command command = new Command();
	command.setTitle(title);
	command.setCommand(commandID);
	command.setArguments(arguments);
	acceptQuickfixCodeAction(context, title, command);
}
 
Example 3
Source File: CodeLensService.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public List<? extends CodeLens> computeCodeLenses(Document document, XtextResource resource, CodeLensParams params,
		CancelIndicator indicator) {
	CodeLens codeLens = new CodeLens();
	Command command = new Command();
	command.setCommand("do.this");
	command.setTitle("Do Awesome Stuff");
	command.setArguments(Lists.newArrayList("foo", Integer.valueOf(1), Boolean.valueOf(true)));
	codeLens.setCommand(command);
	Position _position = new Position(1, 2);
	codeLens.setData(_position);
	return Lists.newArrayList(codeLens);
}
 
Example 4
Source File: CodeActionService.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private Command fixInvalidName(Diagnostic d, ICodeActionService2.Options options) {
	String string = options.getDocument().getSubstring(d.getRange());
	Command command = new Command();
	command.setCommand("my.textedit.command");
	command.setTitle("Make '" + string + "' upper case");
	WorkspaceEdit workspaceEdit = new WorkspaceEdit();
	TextEdit textEdit = new TextEdit();
	textEdit.setNewText(StringExtensions.toFirstUpper(string));
	textEdit.setRange(d.getRange());
	workspaceEdit.getChanges().put(options.getCodeActionParams().getTextDocument().getUri(),
			Lists.newArrayList(textEdit));
	command.setArguments(Lists.newArrayList(workspaceEdit));
	return command;
}