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


Java Range.setEnd方法代码示例

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


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

示例1: testCodeAction_exception

import org.eclipse.lsp4j.Range; //导入方法依赖的package包/类
@Test
public void testCodeAction_exception() throws JavaModelException {
	URI uri = project.getFile("nopackage/Test.java").getRawLocationURI();
	ICompilationUnit cu = JDTUtils.resolveCompilationUnit(uri);
	try {
		cu.becomeWorkingCopy(new NullProgressMonitor());
		CodeActionParams params = new CodeActionParams();
		params.setTextDocument(new TextDocumentIdentifier(uri.toString()));
		final Range range = new Range();
		range.setStart(new Position(0, 17));
		range.setEnd(new Position(0, 17));
		params.setRange(range);
		CodeActionContext context = new CodeActionContext();
		context.setDiagnostics(Collections.emptyList());
		params.setContext(context);
		List<? extends Command> commands = server.codeAction(params).join();
		Assert.assertNotNull(commands);
		Assert.assertEquals(0, commands.size());
	} finally {
		cu.discardWorkingCopy();
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:23,代码来源:CodeActionHandlerTest.java

示例2: change

import org.eclipse.lsp4j.Range; //导入方法依赖的package包/类
private TextEdit change(final Position startPos, final Position endPos, final String newText) {
  TextEdit _textEdit = new TextEdit();
  final Procedure1<TextEdit> _function = (TextEdit it) -> {
    if ((startPos != null)) {
      Range _range = new Range();
      final Procedure1<Range> _function_1 = (Range it_1) -> {
        it_1.setStart(startPos);
        it_1.setEnd(endPos);
      };
      Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1);
      it.setRange(_doubleArrow);
    }
    it.setNewText(newText);
  };
  return ObjectExtensions.<TextEdit>operator_doubleArrow(_textEdit, _function);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:DocumentTest.java

示例3: testRangeFormattingService

import org.eclipse.lsp4j.Range; //导入方法依赖的package包/类
@Test
public void testRangeFormattingService() {
  final Procedure1<RangeFormattingConfiguration> _function = (RangeFormattingConfiguration it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("type Foo{int bar} type Bar{Foo foo}");
    it.setModel(_builder.toString());
    Range _range = new Range();
    final Procedure1<Range> _function_1 = (Range it_1) -> {
      Position _position = new Position(0, 0);
      it_1.setStart(_position);
      Position _position_1 = new Position(0, 17);
      it_1.setEnd(_position_1);
    };
    Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1);
    it.setRange(_doubleArrow);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("type Foo{");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("int bar");
    _builder_1.newLine();
    _builder_1.append("} type Bar{Foo foo}");
    it.setExpectedText(_builder_1.toString());
  };
  this.testRangeFormatting(_function);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:27,代码来源:FormattingTest.java

示例4: toTextEdit

import org.eclipse.lsp4j.Range; //导入方法依赖的package包/类
protected TextEdit toTextEdit(final Document document, final String formattedText, final int startOffset, final int length) {
  TextEdit _textEdit = new TextEdit();
  final Procedure1<TextEdit> _function = (TextEdit it) -> {
    it.setNewText(formattedText);
    Range _range = new Range();
    final Procedure1<Range> _function_1 = (Range it_1) -> {
      it_1.setStart(document.getPosition(startOffset));
      it_1.setEnd(document.getPosition((startOffset + length)));
    };
    Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1);
    it.setRange(_doubleArrow);
  };
  return ObjectExtensions.<TextEdit>operator_doubleArrow(_textEdit, _function);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:FormattingService.java

示例5: toRange

import org.eclipse.lsp4j.Range; //导入方法依赖的package包/类
public static Range toRange(final SourceSection ss) {
  Range range = new Range();
  range.setStart(pos(ss.getStartLine(), ss.getStartColumn()));
  range.setEnd(pos(ss.getEndLine(), ss.getEndColumn() + 1));
  return range;
}
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:7,代码来源:SomAdapter.java

示例6: toRangeMax

import org.eclipse.lsp4j.Range; //导入方法依赖的package包/类
public static Range toRangeMax(final SourceCoordinate coord) {
  Range range = new Range();
  range.setStart(pos(coord.startLine, coord.startColumn));
  range.setEnd(pos(coord.startLine, Integer.MAX_VALUE));
  return range;
}
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:7,代码来源:SomAdapter.java


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