本文整理汇总了Java中org.eclipse.lsp4j.Range.setStart方法的典型用法代码示例。如果您正苦于以下问题:Java Range.setStart方法的具体用法?Java Range.setStart怎么用?Java Range.setStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.lsp4j.Range
的用法示例。
在下文中一共展示了Range.setStart方法的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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}