Search in sources :

Example 21 with BadLocationException

use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.

the class ListLineTracker method getLineOffset.

@Override
public final int getLineOffset(int line) throws BadLocationException {
    int lines = fLines.size();
    if (line < 0 || line > lines)
        throw new BadLocationException();
    if (lines == 0)
        return 0;
    if (line == lines) {
        Line l = fLines.get(line - 1);
        if (l.delimiter != null)
            return l.offset + l.length;
        throw new BadLocationException();
    }
    Line l = fLines.get(line);
    return l.offset;
}
Also used : BadLocationException(org.springframework.ide.vscode.commons.util.BadLocationException)

Example 22 with BadLocationException

use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.

the class ListLineTracker method getLineLength.

@Override
public final int getLineLength(int line) throws BadLocationException {
    int lines = fLines.size();
    if (line < 0 || line > lines)
        throw new BadLocationException();
    if (lines == 0 || lines == line)
        return 0;
    Line l = fLines.get(line);
    return l.length;
}
Also used : BadLocationException(org.springframework.ide.vscode.commons.util.BadLocationException)

Example 23 with BadLocationException

use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.

the class ListLineTracker method getLineInformation.

@Override
public final IRegion getLineInformation(int line) throws BadLocationException {
    int lines = fLines.size();
    if (line < 0 || line > lines)
        throw new BadLocationException();
    if (lines == 0)
        return new Line(0, 0);
    if (line == lines) {
        Line l = fLines.get(line - 1);
        return new Line(l.offset + l.length, 0);
    }
    Line l = fLines.get(line);
    return (l.delimiter != null ? new Line(l.offset, l.length - l.delimiter.length()) : l);
}
Also used : BadLocationException(org.springframework.ide.vscode.commons.util.BadLocationException)

Aggregations

BadLocationException (org.springframework.ide.vscode.commons.util.BadLocationException)23 Range (org.eclipse.lsp4j.Range)10 IMethodBinding (org.eclipse.jdt.core.dom.IMethodBinding)9 Location (org.eclipse.lsp4j.Location)5 ASTNode (org.eclipse.jdt.core.dom.ASTNode)4 SimpleName (org.eclipse.jdt.core.dom.SimpleName)4 TextDocument (org.springframework.ide.vscode.commons.util.text.TextDocument)3 ImmutableList (com.google.common.collect.ImmutableList)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 QualifiedName (org.eclipse.jdt.core.dom.QualifiedName)2 StringLiteral (org.eclipse.jdt.core.dom.StringLiteral)2 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 File (java.io.File)1 Paths (java.nio.file.Paths)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1