本文整理汇总了Java中org.eclipse.lsp4j.ReferenceParams类的典型用法代码示例。如果您正苦于以下问题:Java ReferenceParams类的具体用法?Java ReferenceParams怎么用?Java ReferenceParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReferenceParams类属于org.eclipse.lsp4j包,在下文中一共展示了ReferenceParams类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testReference
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Test
public void testReference(){
URI uri = project.getFile("src/java/Foo2.java").getRawLocationURI();
String fileURI = ResourceUtils.fixURI(uri);
ReferenceParams param = new ReferenceParams();
param.setPosition(new Position(5,16));
param.setContext(new ReferenceContext(true));
param.setTextDocument( new TextDocumentIdentifier(fileURI));
List<Location> references = handler.findReferences(param, monitor);
assertNotNull("findReferences should not return null",references);
assertEquals(1, references.size());
Location l = references.get(0);
String refereeUri = ResourceUtils.fixURI(project.getFile("src/java/Foo3.java").getRawLocationURI());
assertEquals(refereeUri, l.getUri());
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:17,代码来源:ReferencesHandlerTest.java
示例2: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends Location>> references(final ReferenceParams params) {
final Function1<CancelIndicator, List<? extends Location>> _function = (CancelIndicator cancelIndicator) -> {
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
DocumentSymbolService _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
}
final DocumentSymbolService documentSymbolService = _get;
if ((documentSymbolService == null)) {
return CollectionLiterals.<Location>emptyList();
}
final Function2<Document, XtextResource, List<? extends Location>> _function_1 = (Document document, XtextResource resource) -> {
return documentSymbolService.getReferences(document, resource, params, this.resourceAccess, this.workspaceManager.getIndex(), cancelIndicator);
};
return this.workspaceManager.<List<? extends Location>>doRead(uri, _function_1);
};
return this.requestManager.<List<? extends Location>>runRead(_function);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:LanguageServerImpl.java
示例3: testEmpty
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Test
public void testEmpty(){
ReferenceParams param = new ReferenceParams();
param.setPosition(new Position(1, 1));
param.setContext(new ReferenceContext(false));
param.setTextDocument( new TextDocumentIdentifier("/foo/bar"));
List<Location> references = handler.findReferences(param, monitor);
assertNotNull(references);
assertTrue("references are not empty", references.isEmpty());
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:ReferencesHandlerTest.java
示例4: getReferences
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
public List<? extends Location> getReferences(final Document document, final XtextResource resource, final ReferenceParams params, final IReferenceFinder.IResourceAccess resourceAccess, final IResourceDescriptions indexData, final CancelIndicator cancelIndicator) {
final int offset = document.getOffSet(params.getPosition());
List<? extends Location> _xifexpression = null;
boolean _isIncludeDeclaration = params.getContext().isIncludeDeclaration();
if (_isIncludeDeclaration) {
_xifexpression = this.getDefinitions(resource, offset, resourceAccess, cancelIndicator);
} else {
_xifexpression = CollectionLiterals.emptyList();
}
final List<? extends Location> definitions = _xifexpression;
final List<? extends Location> references = this.getReferences(resource, offset, resourceAccess, indexData, cancelIndicator);
final Iterable<Location> result = Iterables.<Location>concat(definitions, references);
return IterableExtensions.<Location>toList(result);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:DocumentSymbolService.java
示例5: actionPerformed
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
// TODO replace this
if (!(activeEditor instanceof TextEditor)) {
return;
}
TextEditor textEditor = ((TextEditor) activeEditor);
String path = activeEditor.getEditorInput().getFile().getLocation().toString();
ReferenceParams paramsDTO = dtoFactory.createDto(ReferenceParams.class);
Position Position = dtoFactory.createDto(Position.class);
Position.setLine(textEditor.getCursorPosition().getLine());
Position.setCharacter(textEditor.getCursorPosition().getCharacter());
TextDocumentIdentifier identifierDTO = dtoFactory.createDto(TextDocumentIdentifier.class);
identifierDTO.setUri(path);
ReferenceContext contextDTO = dtoFactory.createDto(ReferenceContext.class);
contextDTO.setIncludeDeclaration(true);
paramsDTO.setUri(path);
paramsDTO.setPosition(Position);
paramsDTO.setTextDocument(identifierDTO);
paramsDTO.setContext(contextDTO);
Promise<List<Location>> promise = client.references(paramsDTO);
presenter.openLocation(promise);
}
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:FindReferencesAction.java
示例6: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends Location>> references(ReferenceParams params) {
LOGGER.info("references: " + params.getTextDocument());
return CompletableFuture.completedFuture(Collections.emptyList());
}
开发者ID:lhein,项目名称:camel-language-server,代码行数:6,代码来源:CamelTextDocumentService.java
示例7: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends Location>> references(final ReferenceParams params) {
// TODO Auto-generated method stub
return null;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:6,代码来源:SomLanguageServer.java
示例8: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends Location>> references(ReferenceParams params) {
logInfo(">> document/references");
ReferencesHandler handler = new ReferencesHandler(this.preferenceManager);
return computeAsync((cc) -> handler.findReferences(params, toMonitor(cc)));
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:7,代码来源:JDTLanguageServer.java
示例9: findReferences
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
public List<Location> findReferences(ReferenceParams param, IProgressMonitor monitor) {
final List<Location> locations = new ArrayList<>();
try {
IJavaElement elementToSearch = JDTUtils.findElementAtSelection(JDTUtils.resolveTypeRoot(param.getTextDocument().getUri()),
param.getPosition().getLine(),
param.getPosition().getCharacter(), this.preferenceManager, monitor);
if(elementToSearch == null) {
return locations;
}
SearchEngine engine = new SearchEngine();
SearchPattern pattern = SearchPattern.createPattern(elementToSearch, IJavaSearchConstants.REFERENCES);
engine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() },
createSearchScope(), new SearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
Object o = match.getElement();
if (o instanceof IJavaElement) {
IJavaElement element = (IJavaElement) o;
ICompilationUnit compilationUnit = (ICompilationUnit) element
.getAncestor(IJavaElement.COMPILATION_UNIT);
Location location = null;
if (compilationUnit != null) {
location = JDTUtils.toLocation(compilationUnit, match.getOffset(),
match.getLength());
}
else{
IClassFile cf = (IClassFile) element.getAncestor(IJavaElement.CLASS_FILE);
if (cf != null && cf.getSourceRange() != null) {
location = JDTUtils.toLocation(cf, match.getOffset(), match.getLength());
}
}
if (location != null ) {
locations.add(location);
}
}
}
}, monitor);
} catch (CoreException e) {
JavaLanguageServerPlugin.logException("Find references failure ", e);
}
return locations;
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:48,代码来源:ReferencesHandler.java
示例10: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends Location>> references(ReferenceParams params) {
throw new UnsupportedOperationException();
}
开发者ID:eclipse,项目名称:lsp4j,代码行数:5,代码来源:MockLanguageServer.java
示例11: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends Location>> references(ReferenceParams params) {
return null;
}
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:MavenTextDocumentService.java
示例12: configureMethods
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的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
示例13: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
/**
* The references request is sent from the client to the server to resolve
* project-wide references for the symbol denoted by the given text document
* position.
*
* Registration Options: TextDocumentRegistrationOptions
*/
@JsonRequest
CompletableFuture<List<? extends Location>> references(ReferenceParams params);
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:10,代码来源:TextDocumentService.java
示例14: references
import org.eclipse.lsp4j.ReferenceParams; //导入依赖的package包/类
/**
* GWT client implementation of {@link TextDocumentService#references(ReferenceParams)}
*
* @param params
* @return
*/
public Promise<List<Location>> references(ReferenceParams params) {
return transmitDtoAndReceiveDtoList(params, "textDocument/references", Location.class);
}
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:TextDocumentServiceClient.java
注:本文中的org.eclipse.lsp4j.ReferenceParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论