本文整理汇总了Java中org.eclipse.lsp4j.CodeLensParams类的典型用法代码示例。如果您正苦于以下问题:Java CodeLensParams类的具体用法?Java CodeLensParams怎么用?Java CodeLensParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeLensParams类属于org.eclipse.lsp4j包,在下文中一共展示了CodeLensParams类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: codeLens
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams params) {
LOGGER.info("codeLens: " + params.getTextDocument());
return CompletableFuture.completedFuture(Collections.emptyList());
}
开发者ID:lhein,项目名称:camel-language-server,代码行数:6,代码来源:CamelTextDocumentService.java
示例2: codeLens
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams params) {
logInfo(">> document/codeLens");
CodeLensHandler handler = new CodeLensHandler(preferenceManager);
return computeAsync((cc) -> {
IProgressMonitor monitor = toMonitor(cc);
try {
Job.getJobManager().join(DocumentLifeCycleHandler.DOCUMENT_LIFE_CYCLE_JOBS, monitor);
} catch (OperationCanceledException ignorable) {
// No need to pollute logs when query is cancelled
} catch (InterruptedException e) {
JavaLanguageServerPlugin.logException(e.getMessage(), e);
}
return handler.getCodeLensSymbols(params.getTextDocument().getUri(), monitor);
});
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:17,代码来源:JDTLanguageServer.java
示例3: testGetCodeLensSymbols
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Test
public void testGetCodeLensSymbols() throws Exception {
String payload = createCodeLensSymbolsRequest("src/java/Foo.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
//when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
//then
assertEquals("Found " + result, 3, result.size());
CodeLens cl = result.get(0);
Range r = cl.getRange();
//CodeLens on main method
assertRange(7, 20, 24, r);
cl = result.get(1);
r = cl.getRange();
// CodeLens on foo method
assertRange(14, 13, 16, r);
cl = result.get(2);
r = cl.getRange();
//CodeLens on Foo type
assertRange(5, 13, 16, r);
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:28,代码来源:CodeLensHandlerTest.java
示例4: testDisableCodeLensSymbols
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Test
public void testDisableCodeLensSymbols() throws Exception {
Preferences noCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, "false"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(noCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String payload = createCodeLensSymbolsRequest("src/java/IFoo.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
//when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
//then
assertEquals(0, result.size());
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:19,代码来源:CodeLensHandlerTest.java
示例5: testEnableImplementationsCodeLensSymbols
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Test
public void testEnableImplementationsCodeLensSymbols() throws Exception {
Preferences implementationsCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.IMPLEMENTATIONS_CODE_LENS_ENABLED_KEY, "true"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(implementationsCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String payload = createCodeLensSymbolsRequest("src/java/IFoo.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
//when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
//then
assertEquals(2, result.size());
CodeLens lens = result.get(1);
@SuppressWarnings("unchecked")
List<Object> data = (List<Object>) lens.getData();
String type = (String) data.get(2);
assertEquals(type, "implementations");
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:24,代码来源:CodeLensHandlerTest.java
示例6: testDisableImplementationsCodeLensSymbols
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Test
public void testDisableImplementationsCodeLensSymbols() throws Exception {
Preferences noImplementationsCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.IMPLEMENTATIONS_CODE_LENS_ENABLED_KEY, "false"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(noImplementationsCodeLenses);
Preferences noReferencesCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, "false"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(noReferencesCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String payload = createCodeLensSymbolsRequest("src/java/IFoo.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
//when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
//then
assertEquals(0, result.size());
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:22,代码来源:CodeLensHandlerTest.java
示例7: codeLens
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends CodeLens>> codeLens(final CodeLensParams params) {
final Function1<CancelIndicator, List<? extends CodeLens>> _function = (CancelIndicator cancelIndicator) -> {
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
ICodeLensService _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<ICodeLensService>get(ICodeLensService.class);
}
final ICodeLensService codeLensService = _get;
if ((codeLensService == null)) {
return CollectionLiterals.<CodeLens>emptyList();
}
final Function2<Document, XtextResource, List<? extends CodeLens>> _function_1 = (Document document, XtextResource resource) -> {
final List<? extends CodeLens> result = codeLensService.computeCodeLenses(document, resource, params, cancelIndicator);
this.installURI(result, uri.toString());
return result;
};
return this.workspaceManager.<List<? extends CodeLens>>doRead(uri, _function_1);
};
return this.requestManager.<List<? extends CodeLens>>runRead(_function);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:LanguageServerImpl.java
示例8: testGetCodeLensSymbolsForClass
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Test
public void testGetCodeLensSymbolsForClass() throws Exception {
Preferences implementationsCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.IMPLEMENTATIONS_CODE_LENS_ENABLED_KEY, "true"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(implementationsCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String uriString = ClassFileUtil.getURI(project, "java.lang.Runnable");
String payload = createCodeLensSymbolRequest(new URI(uriString));
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
List<CodeLens> lenses = handler.getCodeLensSymbols(uri, monitor);
assertEquals("Found " + lenses, 3, lenses.size());
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:15,代码来源:CodeLensHandlerTest.java
示例9: testGetCodeLenseBoundaries
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Test
public void testGetCodeLenseBoundaries() {
List<CodeLens> result = handler.getCodeLensSymbols(null, monitor);
assertNotNull(result);
assertEquals(0, result.size());
String payload = createCodeLensSymbolsRequest("src/java/Missing.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
result = handler.getCodeLensSymbols(uri, monitor);
assertEquals(0, result.size());
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:13,代码来源:CodeLensHandlerTest.java
示例10: testIgnoreLombokCodeLensSymbols
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Test
public void testIgnoreLombokCodeLensSymbols() throws Exception {
String payload = createCodeLensSymbolsRequest("src/java/Bar.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
//when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
//then
assertEquals("Found " + result, 4, result.size());
//CodeLens on constructor
CodeLens cl = result.get(0);
assertRange(7, 11, 14, cl.getRange());
//CodeLens on somethingFromJPAModelGen
cl = result.get(1);
assertRange(16, 16, 40, cl.getRange());
// CodeLens on foo
cl = result.get(2);
assertRange(22, 16, 19, cl.getRange());
//CodeLens on Bar type
cl = result.get(3);
assertRange(5, 13, 16, cl.getRange());
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:29,代码来源:CodeLensHandlerTest.java
示例11: provideCodeLenses
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Override
public CompletableFuture<ICodeLens[]> provideCodeLenses(ICodeLensContext context, IProgressMonitor monitor) {
ITextEditor textEditor = ((IEditorCodeLensContext) context).getTextEditor();
LSPDocumentInfo info = null;
Collection<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor(
LSPEclipseUtils.getDocument((ITextEditor) textEditor),
capabilities -> capabilities.getCodeLensProvider() != null);
if (!infos.isEmpty()) {
info = infos.iterator().next();
} else {
info = null;
}
if (info != null) {
CodeLensParams param = new CodeLensParams(new TextDocumentIdentifier(info.getFileUri().toString()));
final CompletableFuture<List<? extends CodeLens>> codeLens = info.getLanguageClient()
.getTextDocumentService().codeLens(param);
return codeLens.thenApply(lens -> {
List<ICodeLens> lenses = new ArrayList<>();
for (CodeLens cl : lens) {
lenses.add(new LSPCodeLens(cl));
}
return lenses.toArray(new ICodeLens[lenses.size()]);
});
// try {
//
//
//
// List<ICodeLens> lenses = new ArrayList<>();
// List<? extends CodeLens> lens = codeLens.get(5000, TimeUnit.MILLISECONDS);
// for (CodeLens cl : lens) {
// lenses.add(new LSPCodeLens(cl));
// }
// return lenses.toArray(new ICodeLens[lenses.size()]);
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
return null;
}
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:44,代码来源:LSPCodeLensProvider.java
示例12: codeLens
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends CodeLens>> codeLens(final CodeLensParams params) {
List<CodeLens> result = new ArrayList<>();
som.getCodeLenses(result, params.getTextDocument().getUri());
return CompletableFuture.completedFuture(result);
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:7,代码来源:SomLanguageServer.java
示例13: codeLens
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams params) {
throw new UnsupportedOperationException();
}
开发者ID:eclipse,项目名称:lsp4j,代码行数:5,代码来源:MockLanguageServer.java
示例14: codeLens
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
@Override
public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams params) {
return null;
}
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:MavenTextDocumentService.java
示例15: codeLens
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
/**
* The code lens request is sent from the client to the server to compute
* code lenses for a given text document.
*
* Registration Options: CodeLensRegistrationOptions
*/
@JsonRequest
CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams params);
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:9,代码来源:TextDocumentService.java
示例16: computeCodeLenses
import org.eclipse.lsp4j.CodeLensParams; //导入依赖的package包/类
/**
* compute code lenses for the given context.
*/
public abstract List<? extends CodeLens> computeCodeLenses(final Document document, final XtextResource resource, final CodeLensParams params, final CancelIndicator indicator);
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:ICodeLensService.java
注:本文中的org.eclipse.lsp4j.CodeLensParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论