当前位置: 首页>>代码示例>>Java>>正文


Java CompletionList.setIsIncomplete方法代码示例

本文整理汇总了Java中org.eclipse.lsp4j.CompletionList.setIsIncomplete方法的典型用法代码示例。如果您正苦于以下问题:Java CompletionList.setIsIncomplete方法的具体用法?Java CompletionList.setIsIncomplete怎么用?Java CompletionList.setIsIncomplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.lsp4j.CompletionList的用法示例。


在下文中一共展示了CompletionList.setIsIncomplete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: completion

import org.eclipse.lsp4j.CompletionList; //导入方法依赖的package包/类
Either<List<CompletionItem>, CompletionList> completion(TextDocumentPositionParams position,
		IProgressMonitor monitor) {
	List<CompletionItem> completionItems = null;
	try {
		ICompilationUnit unit = JDTUtils.resolveCompilationUnit(position.getTextDocument().getUri());
		completionItems = this.computeContentAssist(unit,
				position.getPosition().getLine(),
				position.getPosition().getCharacter(), monitor);
	} catch (OperationCanceledException ignorable) {
		// No need to pollute logs when query is cancelled
		monitor.setCanceled(true);
	} catch (Exception e) {
		JavaLanguageServerPlugin.logException("Problem with codeComplete for " +  position.getTextDocument().getUri(), e);
		monitor.setCanceled(true);
	}
	CompletionList $ = new CompletionList();
	if (monitor.isCanceled()) {
		$.setIsIncomplete(true);
		completionItems = null;
		JavaLanguageServerPlugin.logInfo("Completion request cancelled");
	} else {
		JavaLanguageServerPlugin.logInfo("Completion request completed");
	}
	$.setItems(completionItems == null ? Collections.emptyList() : completionItems);
	return Either.forRight($);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:27,代码来源:CompletionHandler.java

示例2: testRequest

import org.eclipse.lsp4j.CompletionList; //导入方法依赖的package包/类
@Test public void testRequest() throws Exception {
	
	TextDocumentPositionParams p = new TextDocumentPositionParams();
	p.setPosition(new Position(1,1));
	p.setTextDocument(new TextDocumentIdentifier("test/foo.txt"));
	
	CompletionList result = new CompletionList();
	result.setIsIncomplete(true);
	result.setItems(new ArrayList<>());
	
	CompletionItem item = new CompletionItem();
	item.setDetail("test");
	item.setDocumentation("doc");
	item.setFilterText("filter");
	item.setInsertText("insert");
	item.setKind(CompletionItemKind.Field);
	result.getItems().add(item);
	
	server.expectedRequests.put("textDocument/completion", new Pair<>(p, result));
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> future = clientLauncher.getRemoteProxy().getTextDocumentService().completion(p);
	Assert.assertEquals(Either.forRight(result).toString(), future.get(TIMEOUT, TimeUnit.MILLISECONDS).toString());
	client.joinOnEmpty();
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:24,代码来源:LauncherTest.java

示例3: getCompletions

import org.eclipse.lsp4j.CompletionList; //导入方法依赖的package包/类
public CompletionList getCompletions(final String docUri, final int line,
    final int character) {
  CompletionList result = new CompletionList();
  result.setIsIncomplete(true);

  SomStructures probe = getProbe(docUri);
  if (probe == null) {
    return result;
  }

  // TODO: this expects that this can be parsed without issues...
  // +1 to get to one based index, - 1 to get back into the element
  ExpressionNode node = probe.getElementAt(line + 1, Math.max(character - 1, 0));
  if (node == null) {
    return result;
  }

  SSymbol sym = null;
  if (node instanceof Send) {
    sym = ((Send) node).getSelector();
  } else {
    if (ServerLauncher.DEBUG) {
      reportError("GET COMPLETIONS, unsupported node: " + node.getClass().getSimpleName());
    }
  }

  if (sym != null) {
    Set<CompletionItem> completion = new HashSet<>();
    Collection<SomStructures> probes = getProbes();

    for (SomStructures s : probes) {
      s.getCompletions(sym, completion);
    }
    result.setItems(new ArrayList<>(completion));
  }

  return result;
}
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:39,代码来源:SomAdapter.java

示例4: createCompletionList

import org.eclipse.lsp4j.CompletionList; //导入方法依赖的package包/类
public CompletionList createCompletionList(final Document document, final XtextResource resource, final TextDocumentPositionParams params, final CancelIndicator cancelIndicator) {
  try {
    final CompletionList result = new CompletionList();
    result.setIsIncomplete(true);
    final IdeContentProposalAcceptor acceptor = this.proposalAcceptorProvider.get();
    final int caretOffset = document.getOffSet(params.getPosition());
    final Position caretPosition = params.getPosition();
    final TextRegion position = new TextRegion(caretOffset, 0);
    try {
      this.createProposals(document.getContents(), position, caretOffset, resource, acceptor);
    } catch (final Throwable _t) {
      if (_t instanceof Throwable) {
        final Throwable t = (Throwable)_t;
        boolean _isOperationCanceledException = this.operationCanceledManager.isOperationCanceledException(t);
        boolean _not = (!_isOperationCanceledException);
        if (_not) {
          throw t;
        }
      } else {
        throw Exceptions.sneakyThrow(_t);
      }
    }
    final Procedure2<ContentAssistEntry, Integer> _function = (ContentAssistEntry it, Integer idx) -> {
      final CompletionItem item = this.toCompletionItem(it, caretOffset, caretPosition, document);
      item.setSortText(Strings.padStart(Integer.toString((idx).intValue()), 5, '0'));
      List<CompletionItem> _items = result.getItems();
      _items.add(item);
    };
    IterableExtensions.<ContentAssistEntry>forEach(acceptor.getEntries(), _function);
    return result;
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:35,代码来源:ContentAssistService.java


注:本文中的org.eclipse.lsp4j.CompletionList.setIsIncomplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。