Java Code Examples for org.eclipse.lsp4j.util.Ranges#containsRange()

The following examples show how to use org.eclipse.lsp4j.util.Ranges#containsRange() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuickfixContext.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Return the current diagnostic or null, if it cannot be determined generically.
 */
public Diagnostic getDiagnostic() {
	CodeActionContext context = options.getCodeActionParams().getContext();
	for (Diagnostic d : context.getDiagnostics()) {
		if (issueCode.equals(d.getCode())) {
			if (Ranges.containsRange(d.getRange(), options.getCodeActionParams().getRange())) {
				return d;
			}
		}
	}
	return null;
}
 
Example 2
Source File: RangesTest.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
@Test(expected = NullPointerException.class)
public void containsRange_nullBigger() {
	Ranges.containsRange(null, newRange(0, 0, 1, 1));
}
 
Example 3
Source File: RangesTest.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
@Test(expected = NullPointerException.class)
public void containsRange_nullSmaller() {
	Ranges.containsRange(newRange(0, 0, 1, 1), null);
}