本文整理汇总了Java中org.eclipse.lsp4j.RenameParams类的典型用法代码示例。如果您正苦于以下问题:Java RenameParams类的具体用法?Java RenameParams怎么用?Java RenameParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenameParams类属于org.eclipse.lsp4j包,在下文中一共展示了RenameParams类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doTest
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
protected void doTest(final String fileName, final Position position) {
try {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileName);
final RenameParams params = new RenameParams(_textDocumentIdentifier, position, "Tescht");
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
StringConcatenation _builder = new StringConcatenation();
_builder.append("changes :");
_builder.newLine();
_builder.append("\t");
_builder.append("MyType1.testlang : Tescht [[0, 5] .. [0, 9]]");
_builder.newLine();
_builder.append("\t");
_builder.append("Tescht [[1, 4] .. [1, 8]]");
_builder.newLine();
_builder.append("\t");
_builder.append("MyType2.testlang : Tescht [[1, 4] .. [1, 8]]");
_builder.newLine();
_builder.append("documentChanges : ");
_builder.newLine();
this.assertEquals(_builder.toString(), this.toExpectation(workspaceEdit));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:RenameTest.java
示例2: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@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);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:LanguageServerImpl.java
示例3: callRename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
private void callRename(String newName, TextPosition cursorPosition, TextEditor editor) {
RenameParams dto = dtoFactory.createDto(RenameParams.class);
TextDocumentIdentifier identifier = dtoFactory.createDto(TextDocumentIdentifier.class);
identifier.setUri(editor.getEditorInput().getFile().getLocation().toString());
dto.setNewName(newName);
dto.setTextDocument(identifier);
org.eclipse.lsp4j.Position position = dtoFactory.createDto(org.eclipse.lsp4j.Position.class);
position.setCharacter(cursorPosition.getCharacter());
position.setLine(cursorPosition.getLine());
dto.setPosition(position);
client
.rename(dto)
.then(this::handleRename)
.catchError(
arg -> {
LOG.error(arg.getMessage());
});
}
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:RenamePresenter.java
示例4: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
public WorkspaceEdit rename(RenameParams params, IProgressMonitor monitor) {
WorkspaceEdit edit = new WorkspaceEdit();
if (!preferenceManager.getPreferences().isRenameEnabled()) {
return edit;
}
try {
final ICompilationUnit unit = JDTUtils.resolveCompilationUnit(params.getTextDocument().getUri());
IJavaElement[] elements = JDTUtils.findElementsAtSelection(unit, params.getPosition().getLine(), params.getPosition().getCharacter(), this.preferenceManager, monitor);
if (elements == null || elements.length == 0) {
return edit;
}
IJavaElement curr = null;
if (elements.length != 1) {
// they could be package fragments.
// We need to select the one that matches the package fragment of the current unit
IPackageFragment packageFragment = (IPackageFragment) unit.getParent();
IJavaElement found = Stream.of(elements).filter(e -> e.equals(packageFragment)).findFirst().orElse(null);
if (found == null) {
// this would be a binary package fragment
curr = elements[0];
} else {
curr = found;
}
} else {
curr = elements[0];
}
RenameProcessor processor = createRenameProcessor(curr);
processor.renameOccurrences(edit, params.getNewName(), monitor);
} catch (CoreException ex) {
JavaLanguageServerPlugin.logException("Problem with rename for " + params.getTextDocument().getUri(), ex);
}
return edit;
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:37,代码来源:RenameHandler.java
示例5: testRenameSelfRef
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Test
public void testRenameSelfRef() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("element Foo {");
_builder.newLine();
_builder.append(" ");
_builder.append("ref Foo");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final String model = _builder.toString();
final String file = this.writeFile("foo/Foo.fileawaretestlanguage", model);
this.initialize();
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(file);
Position _position = new Position(2, 9);
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Bar");
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("changes :");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Foo.fileawaretestlanguage : Bar [[2, 8] .. [2, 11]]");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Bar [[3, 5] .. [3, 8]]");
_builder_1.newLine();
_builder_1.append("documentChanges : ");
_builder_1.newLine();
this.assertEquals(_builder_1.toString(), this.toExpectation(workspaceEdit));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:38,代码来源:RenameTest2.java
示例6: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Override
public WorkspaceEdit rename(final WorkspaceManager workspaceManager, final RenameParams renameParams, final CancelIndicator cancelIndicator) {
WorkspaceEdit _xblockexpression = null;
{
final URI uri = this._uriExtensions.toUri(renameParams.getTextDocument().getUri());
final ServerRefactoringIssueAcceptor issueAcceptor = this.issueProvider.get();
final Function2<Document, XtextResource, WorkspaceEdit> _function = (Document document, XtextResource resource) -> {
final ProjectManager projectManager = workspaceManager.getProjectManager(uri);
final XtextResourceSet resourceSet = projectManager.createNewResourceSet(projectManager.getIndexState().getResourceDescriptions());
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)) {
final EObject element = this._eObjectAtOffsetHelper.resolveElementAt(((XtextResource)xtextResource), offset);
if (((element == null) || element.eIsProxy())) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("No element found at position line:");
int _line = renameParams.getPosition().getLine();
_builder.append(_line);
_builder.append(" column:");
int _character = renameParams.getPosition().getCharacter();
_builder.append(_character);
issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, _builder.toString());
} else {
String _newName = renameParams.getNewName();
URI _uRI = EcoreUtil.getURI(element);
final RenameChange change = new RenameChange(_newName, _uRI);
final IChangeSerializer changeSerializer = this.changeSerializerProvider.get();
final RenameContext context = new RenameContext(Collections.<RenameChange>unmodifiableList(CollectionLiterals.<RenameChange>newArrayList(change)), resourceSet, changeSerializer, issueAcceptor);
this.renameStrategy.applyRename(context);
final ChangeConverter changeConverter = this.converterFactory.create(workspaceManager, workspaceEdit);
changeSerializer.applyModifications(changeConverter);
}
} else {
issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, "Loaded resource is not an XtextResource", resource.getURI());
}
return workspaceEdit;
};
_xblockexpression = workspaceManager.<WorkspaceEdit>doRead(uri, _function);
}
return _xblockexpression;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:44,代码来源:RenameService.java
示例7: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Override
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
LOGGER.info("rename: " + params.getTextDocument());
return CompletableFuture.completedFuture(null);
}
开发者ID:lhein,项目名称:camel-language-server,代码行数:6,代码来源:CamelTextDocumentService.java
示例8: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Override
public CompletableFuture<WorkspaceEdit> rename(final RenameParams params) {
// TODO Auto-generated method stub
return null;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:6,代码来源:SomLanguageServer.java
示例9: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Override
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
logInfo(">> document/rename");
RenameHandler handler = new RenameHandler(preferenceManager);
return computeAsync((cc) -> handler.rename(params, toMonitor(cc)));
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:7,代码来源:JDTLanguageServer.java
示例10: getRenameEdit
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
private WorkspaceEdit getRenameEdit(ICompilationUnit cu, Position pos, String newName) {
TextDocumentIdentifier identifier = new TextDocumentIdentifier(JDTUtils.toURI(cu));
RenameParams params = new RenameParams(identifier, pos, newName);
return handler.rename(params, monitor);
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:7,代码来源:RenameHandlerTest.java
示例11: testRenameContainer
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Test
public void testRenameContainer() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("element Foo {");
_builder.newLine();
_builder.append(" ");
_builder.append("element Bar {");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append(" ");
_builder.append("ref foo.Foo.Bar");
_builder.newLine();
_builder.append(" ");
_builder.append("ref Foo.Bar");
_builder.newLine();
_builder.append(" ");
_builder.append("ref Bar");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final String model = _builder.toString();
final String file = this.writeFile("foo/Foo.fileawaretestlanguage", model);
this.initialize();
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(file);
Position _position = new Position(2, 9);
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Baz");
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("changes :");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Foo.fileawaretestlanguage : Baz [[2, 8] .. [2, 11]]");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Bar [[5, 5] .. [5, 16]]");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Bar [[6, 5] .. [6, 12]]");
_builder_1.newLine();
_builder_1.append("documentChanges : ");
_builder_1.newLine();
this.assertEquals(_builder_1.toString(), this.toExpectation(workspaceEdit));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:53,代码来源:RenameTest2.java
示例12: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Override
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
throw new UnsupportedOperationException();
}
开发者ID:eclipse,项目名称:lsp4j,代码行数:5,代码来源:MockLanguageServer.java
示例13: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@Override
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
return null;
}
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:MavenTextDocumentService.java
示例14: configureMethods
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
@PostConstruct
public void configureMethods() {
dtoToDtoList(
"definition", TextDocumentPositionParams.class, LocationDto.class, this::definition);
dtoToDtoList("codeAction", CodeActionParams.class, CommandDto.class, this::codeAction);
dtoToDtoList(
"documentSymbol",
DocumentSymbolParams.class,
SymbolInformationDto.class,
this::documentSymbol);
dtoToDtoList("formatting", DocumentFormattingParams.class, TextEditDto.class, this::formatting);
dtoToDtoList(
"rangeFormatting",
DocumentRangeFormattingParams.class,
TextEditDto.class,
this::rangeFormatting);
dtoToDtoList("references", ReferenceParams.class, LocationDto.class, this::references);
dtoToDtoList(
"onTypeFormatting",
DocumentOnTypeFormattingParams.class,
TextEditDto.class,
this::onTypeFormatting);
dtoToDto(
"completionItem/resolve",
ExtendedCompletionItem.class,
ExtendedCompletionItemDto.class,
this::completionItemResolve);
dtoToDto(
"documentHighlight",
TextDocumentPositionParams.class,
DocumentHighlight.class,
this::documentHighlight);
dtoToDto(
"completion",
TextDocumentPositionParams.class,
ExtendedCompletionListDto.class,
this::completion);
dtoToDto("hover", TextDocumentPositionParams.class, HoverDto.class, this::hover);
dtoToDto(
"signatureHelp",
TextDocumentPositionParams.class,
SignatureHelpDto.class,
this::signatureHelp);
dtoToDto("rename", RenameParams.class, RenameResultDto.class, this::rename);
dtoToNothing("didChange", DidChangeTextDocumentParams.class, this::didChange);
dtoToNothing("didClose", DidCloseTextDocumentParams.class, this::didClose);
dtoToNothing("didOpen", DidOpenTextDocumentParams.class, this::didOpen);
dtoToNothing("didSave", DidSaveTextDocumentParams.class, this::didSave);
}
开发者ID:eclipse,项目名称:che,代码行数:53,代码来源:TextDocumentService.java
示例15: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
/**
* The rename request is sent from the client to the server to do a
* workspace wide rename of a symbol.
*
* Registration Options: TextDocumentRegistrationOptions
*/
@JsonRequest
CompletableFuture<WorkspaceEdit> rename(RenameParams params);
开发者ID:eclipse,项目名称:lsp4j,代码行数:9,代码来源:TextDocumentService.java
示例16: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
/**
* GWT client implementation of {@link TextDocumentService#rename(RenameParams)}
*
* @param params
* @return a {@link Promise} of a rename result object which contains all workspace edits.
*/
public Promise<RenameResult> rename(RenameParams params) {
return transmitDtoAndReceiveDto(params, "textDocument/rename", RenameResult.class);
}
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:TextDocumentServiceClient.java
示例17: rename
import org.eclipse.lsp4j.RenameParams; //导入依赖的package包/类
public abstract WorkspaceEdit rename(final WorkspaceManager workspaceManager, final RenameParams renameParams, final CancelIndicator cancelIndicator);
开发者ID:eclipse,项目名称:xtext-core,代码行数:2,代码来源:IRenameService.java
注:本文中的org.eclipse.lsp4j.RenameParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论