Package melnorme.lang.tooling.ops

Examples of melnorme.lang.tooling.ops.FindDefinitionResult


    JSONObject describe = jsonResult.getJSONObject("describe");
   
    String desc = describe.getString("desc");
   
    if(areEqual(desc, "source file")) {
      return new FindDefinitionResult(null, null);
    }
    if(!areEqual(desc, "identifier")) {
      return new FindDefinitionResult(
        "Selected name does not refer to a source element, rather it's a:\n" + desc, null);
    }
   
   
    JSONObject value = describe.getJSONObject("value");
   
    String pathStr = value.getString("objpos");
    // We will need to parse objpos from the end, because on Windows the filePath can contain the ':' char
   
    String columnStr = StringUtil.segmentAfterLastMatch(pathStr, ":");
    pathStr = StringUtil.substringUntilLastMatch(pathStr, ":");

    String lineStr = StringUtil.segmentAfterLastMatch(pathStr, ":");
    pathStr = StringUtil.substringUntilLastMatch(pathStr, ":");
   
   
    if(columnStr == null || lineStr == null) {
      throw new CommonException("No line or column position given.", null);
    }
    int line = parseInt(lineStr, "Invalid number for line: " + lineStr);
    int column = parseInt(columnStr, "Invalid number for column: " + columnStr);
   
    Path path = parsePath(pathStr);
   
    return new FindDefinitionResult(null, new SourceLineColumnLocation(path, line, column));
  }
View Full Code Here


  public void test() throws Exception { test$(); }
  public void test$() throws Exception {
   
    GoOracleFindDefinitionOperation op = new GoOracleFindDefinitionOperation("gopath");
   
    FindDefinitionResult result = op.parseJsonResult(
      getClassResourceAsString(GoOracleFindDefinitionOperation_Test.class, "result1.json"));
   
    SourceLineColumnLocation loc = result.getLocation();
   
    assertEquals(loc, new SourceLineColumnLocation(
      path("D:\\devel\\tools.Go\\go-workspace\\src\\github.com\\user\\newmath\\sqrt.go"), 5, 6));
  }
View Full Code Here

TOP

Related Classes of melnorme.lang.tooling.ops.FindDefinitionResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.