org.eclipse.lsp4j.WorkspaceEdit.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.eclipse.lsp4j.WorkspaceEdit.<init>()方法的一些代码示例,展示了WorkspaceEdit.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkspaceEdit.<init>()方法的具体详情如下:
包路径:org.eclipse.lsp4j.WorkspaceEdit
类名称:WorkspaceEdit
方法名:<init>

WorkspaceEdit.<init>介绍

暂无

代码示例

代码示例来源:origin: eclipse/eclipse.jdt.ls

public WorkspaceEdit organizeImportsInFile(String fileUri) {
  WorkspaceEdit rootEdit = new WorkspaceEdit();
  ICompilationUnit unit = null;
  if (JDTUtils.toURI(fileUri) != null) {
    unit = JDTUtils.resolveCompilationUnit(fileUri);
  }
  if (unit == null) {
    return rootEdit;
  }
  organizeImportsInCompilationUnit(unit, rootEdit);
  return rootEdit;
}

代码示例来源:origin: org.ballerinalang/language-server-core

/**
 * Apply a workspace edit for the current instance.
 *
 * @param textDocumentEdits List of document edits for current session
 * @param client            Language Client
 * @return {@link Object}       workspace edit parameters
 */
public static Object applyWorkspaceEdit(List<TextDocumentEdit> textDocumentEdits, LanguageClient client) {
  WorkspaceEdit workspaceEdit = new WorkspaceEdit();
  workspaceEdit.setDocumentChanges(textDocumentEdits);
  ApplyWorkspaceEditParams applyWorkspaceEditParams = new ApplyWorkspaceEditParams(workspaceEdit);
  if (client != null) {
    client.applyEdit(applyWorkspaceEditParams);
  }
  return applyWorkspaceEditParams;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

/**
 * Organize imports when select a project.
 *
 * @param proj
 *            the target project
 * @return
 */
public WorkspaceEdit organizeImportsInProject(IProject proj) {
  WorkspaceEdit rootEdit = new WorkspaceEdit();
  HashSet<IJavaElement> result = new HashSet<>();
  collectCompilationUnits(JavaCore.create(proj), result, null);
  for (IJavaElement elem : result) {
    if (elem.getElementType() == IJavaElement.COMPILATION_UNIT) {
      organizeImportsInCompilationUnit((ICompilationUnit) elem, rootEdit);
    }
  }
  return rootEdit;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

public Object organizeImports(List<Object> arguments) throws CoreException {
  WorkspaceEdit edit = new WorkspaceEdit();
  if (arguments != null && !arguments.isEmpty() && arguments.get(0) instanceof String) {
    final String fileUri = (String) arguments.get(0);

代码示例来源:origin: org.ballerinalang/language-server-core

/**
 * Apply a given single text edit.
 *
 * @param editText   Edit text to be inserted
 * @param range      Line Range to be processed
 * @param identifier Document identifier
 * @param client     Language Client
 * @return {@link ApplyWorkspaceEditParams}     Workspace edit params
 */
public static ApplyWorkspaceEditParams applySingleTextEdit(String editText, Range range,
                              VersionedTextDocumentIdentifier identifier,
                              LanguageClient client) {
  WorkspaceEdit workspaceEdit = new WorkspaceEdit();
  ApplyWorkspaceEditParams applyWorkspaceEditParams = new ApplyWorkspaceEditParams();
  TextEdit textEdit = new TextEdit(range, editText);
  TextDocumentEdit textDocumentEdit = new TextDocumentEdit(identifier,
                               Collections.singletonList(textEdit));
  workspaceEdit.setDocumentChanges(Collections.singletonList(textDocumentEdit));
  applyWorkspaceEditParams.setEdit(workspaceEdit);
  if (client != null) {
    client.applyEdit(applyWorkspaceEditParams);
  }
  return applyWorkspaceEditParams;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private static WorkspaceEdit convertChangeToWorkspaceEdit(ICompilationUnit unit, Change change) throws CoreException {
  WorkspaceEdit $ = new WorkspaceEdit();
  if (change instanceof TextChange) {
    TextEditConverter converter = new TextEditConverter(unit, ((TextChange) change).getEdit());
    String uri = JDTUtils.toURI(unit);
    $.getChanges().put(uri, converter.convert());
  } else if (change instanceof ResourceChange) {
    ChangeUtil.convertResourceChange((ResourceChange) change, $);
  } else if (change instanceof CompositeChange) {
    ChangeUtil.convertCompositeChange(change, $);
  }
  return $;
}

代码示例来源:origin: org.ballerinalang/language-server-core

WorkspaceEdit workspaceEdit = new WorkspaceEdit();
ApplyWorkspaceEditParams applyWorkspaceEditParams = new ApplyWorkspaceEditParams();
TextDocumentEdit textDocumentEdit = new TextDocumentEdit(params.getDocumentIdentifier(),

代码示例来源:origin: spring-projects/sts4

public static QuickfixEdit createReplacementQuickfic(TextDocument doc, YamlPathEdits edits) throws BadLocationException {
  TextReplace replaceEdit = edits.asReplacement(doc);
  if (replaceEdit!=null) {
    WorkspaceEdit wsEdits = new WorkspaceEdit();
    wsEdits.setChanges(ImmutableMap.of(
        doc.getUri(),
        ImmutableList.of(new TextEdit(doc.toRange(replaceEdit.getRegion()), replaceEdit.newText))
    ));
    Position newCursor = getCursorPostionAfter(doc, edits);
    return new QuickfixEdit(wsEdits, newCursor==null ? null : new CursorMovement(doc.getUri(), newCursor));
  }
  return NULL_FIX;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

WorkspaceEdit rootEdit = new WorkspaceEdit();
IPackageFragment fragment = null;
if (JDTUtils.toURI(folderUri) != null) {

代码示例来源:origin: org.ballerinalang/language-server-core

WorkspaceEdit workspaceEdit = new WorkspaceEdit();
ApplyWorkspaceEditParams applyWorkspaceEditParams = new ApplyWorkspaceEditParams();
TextDocumentEdit textDocumentEdit = new TextDocumentEdit(notification.getTextDocumentIdentifier(),

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.ide

@Override
public CompletableFuture<WorkspaceEdit> rename(final RenameParams params) {
 final Function1<CancelIndicator, WorkspaceEdit> _function = (CancelIndicator cancelIndicator) -> {
  WorkspaceEdit _xblockexpression = null;
  {
   final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
   final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
   IRenameService _get = null;
   if (resourceServiceProvider!=null) {
    _get=resourceServiceProvider.<IRenameService>get(IRenameService.class);
   }
   final IRenameService renameService = _get;
   if ((renameService == null)) {
    return new WorkspaceEdit();
   }
   _xblockexpression = renameService.rename(this.workspaceManager, params, cancelIndicator);
  }
  return _xblockexpression;
 };
 return this.requestManager.<WorkspaceEdit>runRead(_function);
}

代码示例来源:origin: spring-projects/sts4

if (_doc!=null) {
  return new QuickfixEdit(
    new WorkspaceEdit(
      ImmutableMap.of(params.getUri(), ImmutableList.of(params.getEdit()))
    ),

代码示例来源:origin: org.ballerinalang/language-server-core

identifier.setUri(testFile.toPath().toUri().toString());
TextDocumentEdit textDocumentEdit = new TextDocumentEdit(identifier, content);
WorkspaceEdit workspaceEdit = new WorkspaceEdit();
workspaceEdit.setDocumentChanges(Collections.singletonList(textDocumentEdit));
ApplyWorkspaceEditParams editParams = new ApplyWorkspaceEditParams();

代码示例来源:origin: org.ballerinalang/language-server-core

Path compilationPath = getUntitledFilePath(renameFilePath.toString()).orElse(renameFilePath);
Optional<Lock> lock = documentManager.lockFile(compilationPath);
WorkspaceEdit workspaceEdit = new WorkspaceEdit();
try {
  LSServiceOperationContext renameContext = new LSServiceOperationContext();

代码示例来源:origin: eclipse/eclipse.jdt.ls

public WorkspaceEdit rename(RenameParams params, IProgressMonitor monitor) {
  WorkspaceEdit edit = new WorkspaceEdit();
  if (!preferenceManager.getPreferences().isRenameEnabled()) {
    return edit;

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.ide

resourceSet.getLoadOptions().put(ResourceDescriptionsProvider.LIVE_SCOPE, Boolean.valueOf(true));
final int offset = document.getOffSet(renameParams.getPosition());
final WorkspaceEdit workspaceEdit = new WorkspaceEdit();
final Resource xtextResource = resourceSet.getResource(resource.getURI(), true);
if ((xtextResource instanceof XtextResource)) {

代码示例来源:origin: eclipse/lsp4j

it.setJsonrpc("2.0");
it.setId("12");
WorkspaceEdit _workspaceEdit = new WorkspaceEdit();
final Procedure1<WorkspaceEdit> _function_2 = (WorkspaceEdit it_1) -> {
 HashMap<String, List<TextEdit>> _hashMap = new HashMap<String, List<TextEdit>>();

代码示例来源:origin: eclipse/lsp4j

it.setJsonrpc("2.0");
it.setId("12");
WorkspaceEdit _workspaceEdit = new WorkspaceEdit();
final Procedure1<WorkspaceEdit> _function_1 = (WorkspaceEdit it_1) -> {
 HashMap<String, List<TextEdit>> _hashMap = new HashMap<String, List<TextEdit>>();

代码示例来源:origin: eclipse/lsp4j

it_1.setKind("fix");
it_1.setDiagnostics(CollectionLiterals.<Diagnostic>newArrayList());
WorkspaceEdit _workspaceEdit = new WorkspaceEdit();
final Procedure1<WorkspaceEdit> _function_3 = (WorkspaceEdit it_2) -> {
 TextEdit _textEdit = new TextEdit();

代码示例来源:origin: eclipse/lsp4j

it.setJsonrpc("2.0");
it.setId("12");
WorkspaceEdit _workspaceEdit = new WorkspaceEdit();
final Procedure1<WorkspaceEdit> _function_2 = (WorkspaceEdit it_1) -> {
 CreateFile _createFile = new CreateFile();

相关文章